Skip to content

fix(docs): Fix light mode text visibility in custom CSS#332

Open
Sridhar1030 wants to merge 3 commits intokubeflow:mainfrom
Sridhar1030:fix/docs-light-mode-text-visibility
Open

fix(docs): Fix light mode text visibility in custom CSS#332
Sridhar1030 wants to merge 3 commits intokubeflow:mainfrom
Sridhar1030:fix/docs-light-mode-text-visibility

Conversation

@Sridhar1030
Copy link

Summary

  • Fixed light mode text being invisible (low contrast) when switching to Light in the Furo theme switcher
  • Custom CSS was using :root:not([data-theme="light"]) for dark overrides, but Furo sets data-theme on body, not :root — so dark variable overrides always applied even in Light mode
  • Switched theme checks to body-based selectors and added explicit body[data-theme="light"] block for correct light-mode colors
    Before
image

Fixes #331

After

image

Test plan

  • Run make docs or make docs-serve
  • Open docs in browser with OS/browser set to dark mode
  • Click the Furo theme switcher and select Light — verify all text (sidebar, headings, body, TOC) is readable (dark on white)
  • Switch to Dark — verify dark theme still works correctly

Furo sets data-theme on body, not :root. Custom CSS used
:root:not([data-theme="light"]) so dark overrides always applied.
Switched to body-based selectors and added explicit
body[data-theme="light"] block for correct light-mode colors.

Fixes kubeflow#331

Signed-off-by: Sridhar1030 <sridharpillai75@gmail.com>
Copilot AI review requested due to automatic review settings February 26, 2026 09:20
@google-oss-prow
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kramaranya for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a light mode text visibility bug in the documentation where text appeared almost invisible (light grey on white background) when users switched to Light mode using the Furo theme switcher. The root cause was that the custom CSS was checking for data-theme on :root when Furo actually sets it on the body element, causing dark mode color variables to always apply.

Changes:

  • Updated CSS selectors from :root-based to body-based to correctly detect Furo theme
  • Added explicit body[data-theme="light"] block to ensure proper light mode colors when user selects Light theme
  • Updated comment to clarify that Furo sets data-theme on body, not :root
Comments suppressed due to low confidence (1)

docs/source/_static/custom.css:73

  • The --kf-accent variable is missing from this dark mode block (it's defined in :root at line 21). For consistency and maintainability, all CSS custom properties should be explicitly defined in each theme block. The dark mode might benefit from a different accent color, or it should explicitly set the same value for clarity.
body[data-theme="dark"] {
    --kf-blue: #63b3ed;
    --kf-blue-light: #90cdf4;
    --kf-blue-dark: #4299e1;
    --kf-heading: #e2e8f0;
    --kf-text: #cbd5e0;
    --kf-text-light: #a0aec0;
    --kf-bg-subtle: #2d3748;
    --kf-border: #4a5568;
    --kf-api-name: #63b3ed;
    --kf-api-param: #a0aec0;
    --kf-api-text: #e2e8f0;
}

Comment on lines 31 to 43
@@ -43,7 +43,22 @@
}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --kf-accent variable is missing from this media query dark mode block (it's defined in :root at line 21). For consistency and maintainability, all CSS custom properties should be explicitly defined in each theme block.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment on lines 47 to 62
/* Explicit light mode - ensure light vars when user selects Light */
body[data-theme="light"] {
--kf-blue: #4299e1;
--kf-blue-light: #63b3ed;
--kf-blue-dark: #3182ce;
--kf-heading: #2d3748;
--kf-text: #4a5568;
--kf-text-light: #718096;
--kf-bg-subtle: #f7fafc;
--kf-border: #e2e8f0;
--kf-accent: #81e6d9;
--kf-api-name: #3182ce;
--kf-api-param: #4a5568;
--kf-api-text: #000;
}

Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body[data-theme="light"] block duplicates the exact same variable values already defined in :root, which increases the chance the light palette drifts out of sync over time; consider removing this block or limiting it to only the variables that truly need to differ from the :root defaults.

Suggested change
/* Explicit light mode - ensure light vars when user selects Light */
body[data-theme="light"] {
--kf-blue: #4299e1;
--kf-blue-light: #63b3ed;
--kf-blue-dark: #3182ce;
--kf-heading: #2d3748;
--kf-text: #4a5568;
--kf-text-light: #718096;
--kf-bg-subtle: #f7fafc;
--kf-border: #e2e8f0;
--kf-accent: #81e6d9;
--kf-api-name: #3182ce;
--kf-api-param: #4a5568;
--kf-api-text: #000;
}

Copilot uses AI. Check for mistakes.
Comment on lines 63 to 75
@@ -52,6 +69,7 @@
--kf-text-light: #a0aec0;
--kf-bg-subtle: #2d3748;
--kf-border: #4a5568;
--kf-accent: #81e6d9;
--kf-api-name: #63b3ed;
--kf-api-param: #a0aec0;
--kf-api-text: #e2e8f0;
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dark palette variables are defined twice (once in the @media (prefers-color-scheme: dark) block and again in body[data-theme="dark"]), which creates a maintenance hazard if one set of values is updated without the other; consider factoring the shared dark values so there is a single source of truth (e.g., alias variables or a shared selector strategy).

Copilot uses AI. Check for mistakes.
… comments

Remove duplicate body[data-theme="light"] block since :root values are
inherited when the media-query selector stops matching. Add explanatory
comment documenting why two dark blocks are needed (system-dark auto vs
explicit dark selection).

Signed-off-by: Sridhar1030 <sridharpillai75@gmail.com>
@andreyvelich
Copy link
Member

/assign @kramaranya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Light mode text invisible (low contrast) when theme set to Light

4 participants