Skip to content

feat(ui): add persistent Dark Mode and Light Mode theme toggle - #3211

Open
vjkumar2756 wants to merge 2 commits into
kubeflow:mainfrom
vjkumar2756:feat/theme-dark-mode
Open

feat(ui): add persistent Dark Mode and Light Mode theme toggle #3211
vjkumar2756 wants to merge 2 commits into
kubeflow:mainfrom
vjkumar2756:feat/theme-dark-mode

Conversation

@vjkumar2756

@vjkumar2756 vjkumar2756 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Fixed #3210

Summary

This PR adds full Dark Mode & Light Mode theme support to the Kubeflow Hub UI. It introduces a persistent theme switcher in the top navigation header bar, respects OS system preferences (prefers-color-scheme), and applies a high-contrast Midnight Slate Dark Design System across all UI components.


What Changed?

1. New Theme Context (ThemeContext.tsx)

  • Created CustomThemeProvider managing theme states (light, dark, system).
  • Added localStorage persistence under key kubeflow_theme_mode.
  • Added dynamic listener for system color scheme changes (matchMedia('(prefers-color-scheme: dark)')).
  • Toggles .dark-theme and .pf-v6-theme-dark CSS classes on document.documentElement.

2. Navigation Bar Theme Switcher (NavBar.tsx)

  • Added a Sun / Moon Toggle Button inside the top navigation masthead next to the user menu.
  • Dynamically updates icon and tooltip based on active theme mode.

3. Application Root (App.tsx)

  • Wrapped the application hierarchy with <CustomThemeProvider>.

4. Custom Dark Theme Styling (app.css)

  • Midnight Slate Color Palette: Main background (#0b0f19), surface cards (#111827), borders (#1e293b).
  • High Contrast Typography: Headings (#f8fafc), body text (#e2e8f0), links & accents (#38bdf8).
  • Targeted Component Styling:
    • Dropdowns & Namespace Selectors (bella-namespace, user@example.com, Keyword filter).
    • Table headers, sort indicators, and table rows with hover highlights.
    • Bottom pagination toolbar background and control buttons.
    • Form controls, search inputs, pills, and chip tags.

User Experience & Key Benefits

  • Eye Strain Reduction: Significantly improves usability for ML engineers working in low-light environments.
  • Instant 1-Click Toggle: Switch themes seamlessly from anywhere in the app without page reload.
  • Zero Breaking Changes: Maintains 100% backward compatibility with Light Mode.

Testing & Verification

  • TypeScript Type Check: Passed (npm run test:type-check) — 0 errors found.
  • Dev Server Build: Webpack dev server compiles cleanly without warnings or errors.
  • Manual Verification: Tested theme switching, page reload persistence, namespace dropdown contrast, and pagination toolbar styling on local standalone deployment (http://localhost:9000).

…Models

Signed-off-by: Vijay <vjkumar2756@gmail.com>
Signed-off-by: Vijay <vjkumar2756@gmail.com>
@google-oss-prow

Copy link
Copy Markdown
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 rareddy 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

@vjkumar2756

Copy link
Copy Markdown
Contributor Author

@pboyd
could you please review this PR when you get a chance.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dark mode and system theme preference in Kubeflow Hub

1 participant