Skip to content

Conversation

@rajramo61
Copy link

This pr covers the issue #25061

Description

This pull request introduces a comprehensive theme toggle system for the website, allowing users to switch between light and dark modes with persistence, accessibility, and internationalization support. The implementation includes a new JavaScript theme toggle handler, a toggle button in the navigation bar, updated SCSS for theme variables and consistent styling, and translation strings for multiple languages.

The most important changes are:

Theme Toggle Functionality:

  • Added a new theme-toggle.js script that manages theme switching, system preference detection, localStorage persistence, updates to UI (including Mermaid diagrams), and exposes a public API for theme control.
  • Injected an early theme initialization script in head.html to prevent flashes of the wrong theme before the page renders.
  • Added a reusable, accessible theme toggle button as a partial (theme-toggle.html) and included it in the navigation bar. The button updates its icon and ARIA labels based on the current theme and is internationalized. [1] [2]

Styling and Theme Variables:

  • Refactored SCSS to use CSS custom properties for theme colors and UI elements, ensuring consistent theming across the site. This includes updates for the homepage, feature sections, search bars, and input fields. [1] [2]
  • Updated the main SCSS import order to include the new theme variables and toggle styles early in the build process.

Internationalization:

  • Added new translation strings for the theme toggle button ("Switch to dark mode"/"Switch to light mode") in English, German, Spanish, French, Japanese, Korean, and Chinese. [1] [2] [3] [4] [5] [6] [7]

Build Integration:

  • Ensured the theme-toggle.js script is included in the main JavaScript bundle by updating the scripts partial.

Issue

Closes: #25061

@k8s-ci-robot
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 divya-mohan0209 for approval. For more information see the 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

@k8s-ci-robot k8s-ci-robot added area/localization General issues or PRs related to localization area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 31, 2026
@k8s-ci-robot k8s-ci-robot added language/de Issues or PRs related to German language language/en Issues or PRs related to English language labels Jan 31, 2026
@k8s-ci-robot
Copy link
Contributor

Welcome @rajramo61!

It looks like this is your first PR to kubernetes/website 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/website has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/zh Issues or PRs related to Chinese language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 31, 2026
@netlify
Copy link

netlify bot commented Jan 31, 2026

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit b5ea622
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/697d86bdbf97c400084c44a0
😎 Deploy Preview https://deploy-preview-54238--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Jan 31, 2026

Pull request preview available for checking

Built without sensitive environment variables

Name Link
🔨 Latest commit cf04084
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-io-main-staging/deploys/697d87eabf97c400084c452d
😎 Deploy Preview https://deploy-preview-54238--kubernetes-io-main-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Labels

area/localization General issues or PRs related to localization area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/de Issues or PRs related to German language language/en Issues or PRs related to English language language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/zh Issues or PRs related to Chinese language sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow switching website between “light mode” and “dark mode”

2 participants