Skip to content

fix: blog dark mode - text invisible on dark background#25620

Merged
krrish-berri-2 merged 1 commit intomainfrom
cursor/fix-blog-dark-mode-4c83
Apr 13, 2026
Merged

fix: blog dark mode - text invisible on dark background#25620
krrish-berri-2 merged 1 commit intomainfrom
cursor/fix-blog-dark-mode-4c83

Conversation

@krrish-berri-2
Copy link
Copy Markdown
Contributor

Relevant issues

Fixes blog dark mode readability issue reported via user feedback — text was invisible (dark text on dark background).

Pre-Submission checklist

  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • N/A: CSS-only change to docs site — no backend/library code affected, no unit tests applicable

Screenshots / Proof of Fix

Before (reported issue): Blog post title, headings, and body text are invisible in dark mode — dark text (#111827) rendered on dark background (#0d1117).

After fix — Blog post page in dark mode:
Blog post in dark mode with readable light text

After fix — Blog list page in dark mode:
Blog list page in dark mode with readable text

Light mode still works correctly:
Blog post in light mode

Video walkthrough:
blog_dark_mode_fix_demo.mp4

Type

🐛 Bug Fix

Changes

Root cause

Docusaurus applies both data-theme="dark" and the blog-wrapper class to the same <html> element. The CSS dark-mode overrides used descendant selectors with a space:

/* BROKEN: looks for .blog-wrapper as a DESCENDANT of [data-theme='dark'] */
[data-theme='dark'] .blog-wrapper article header h1 { color: #f9fafb; }

Since both attributes are on <html>, .blog-wrapper is never a descendant of [data-theme='dark'] — they're on the same element. The dark-mode overrides never applied, leaving the light-mode colors (#111827 dark text) on the dark background (#0d1117).

Fix

Changed to compound selectors (no space) so both conditions match the same <html> element:

/* FIXED: matches <html data-theme="dark" class="blog-wrapper"> */
[data-theme='dark'].blog-wrapper article header h1 { color: #f9fafb; }

Additional improvements

  • Added missing dark-mode overrides for pre code blocks and links in blog posts
  • Added dark-mode overrides for blog list page elements: marquee items, pagination links, meta text, and author separators

To show artifacts inline, enable in settings.

Slack Thread

Open in Web Open in Cursor 

The blog CSS selectors for dark mode used descendant selectors like
[data-theme='dark'] .blog-wrapper which never matched because both
data-theme and .blog-wrapper are applied to the same <html> element
by Docusaurus. Fixed by using compound selectors (no space):
[data-theme='dark'].blog-wrapper.

Also added missing dark-mode overrides for:
- pre/code blocks in blog posts
- link colors in blog posts
- marquee items, separators, and labels on blog list page
- pagination links on blog list page
- meta text and author separators on blog list page

Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 13, 2026 5:40am

Request Review

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Apr 13, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing cursor/fix-blog-dark-mode-4c83 (b4860ee) with main (5e80e07)

Open in CodSpeed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR fixes a dark mode readability bug on the blog pages caused by incorrect CSS selector specificity. Both data-theme="dark" and blog-wrapper are applied to the same <html> element by Docusaurus, so descendant selectors ([data-theme='dark'] .blog-wrapper) never matched. The fix correctly changes them to compound selectors ([data-theme='dark'].blog-wrapper). Additional dark mode overrides for pre blocks, links, and blog list page elements are also added.

Confidence Score: 5/5

CSS-only docs fix with no backend impact — safe to merge.

All changes are confined to documentation site CSS. The selector fix is technically correct (compound vs. descendant for same-element attributes), all targeted CSS module classes exist, and !important usage is consistent with pre-existing patterns in the same file. No logic, security, or data concerns.

No files require special attention.

Important Files Changed

Filename Overview
docs/my-website/src/css/custom.css Fixes dark mode blog selectors from descendant to compound form; adds missing pre and a overrides. !important on pre is consistent with existing light-mode rules for the same element.
docs/my-website/src/theme/BlogListPage/styles.module.css Adds dark mode overrides for marquee, pagination, meta, and separator elements. Descendant selectors are correct here since these CSS module classes are on child elements, not on <html>.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["<html data-theme='dark' class='blog-wrapper'>"] --> B{Selector type}
    B -->|"BROKEN: descendant\n[data-theme='dark'] .blog-wrapper h1"| C["Looks for .blog-wrapper\nas a CHILD of html[data-theme='dark']"]
    C --> D["No match — both attrs\nare on the same element"]
    B -->|"FIXED: compound\n[data-theme='dark'].blog-wrapper h1"| E["Matches html element\nthat has BOTH attributes"]
    E --> F["dark-mode color applied\ncolor: #f9fafb"]
    D --> G["Light-mode color leaks through\ncolor: #111827 on dark background"]
Loading

Reviews (1): Last reviewed commit: "fix: blog dark mode - text invisible on ..." | Re-trigger Greptile

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@krrish-berri-2 krrish-berri-2 merged commit d319cd8 into main Apr 13, 2026
50 of 51 checks passed
@krrish-berri-2 krrish-berri-2 deleted the cursor/fix-blog-dark-mode-4c83 branch April 13, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants