Skip to content

Add Follow system mode option to Light / Dark theme palette toggle options - #1970

Open
Coderambling wants to merge 1 commit into
holoviz:mainfrom
Coderambling:patch-8
Open

Add Follow system mode option to Light / Dark theme palette toggle options#1970
Coderambling wants to merge 1 commit into
holoviz:mainfrom
Coderambling:patch-8

Conversation

@Coderambling

Copy link
Copy Markdown
Contributor

Adds a Follow system mode option to Light / Dark theme palette toggle options.

Additional icon added for the system preferences option from the same source as the light / dark theme icons:

https://mui.com/material-ui/material-icons/

Assumption

icon library is already referenced in build files, so additional icon should load.

Code changes

Code changes follow Zensical documentation guidelines for adding this mode:

https://zensical.org/docs/setup/colors/?h=.toggle#automatic-light-dark-mode

Section in Zensical docs
# Palette toggle for automatic mode
[[project.theme.palette]]
media = "(prefers-color-scheme)"
toggle.icon = "lucide/sun-moon"
toggle.name = "Switch to light mode"

# Palette toggle for light mode
[[project.theme.palette]]
media = "(prefers-color-scheme: light)"
scheme = "default"
toggle.icon = "lucide/sun"
toggle.name = "Switch to dark mode"

# Palette toggle for dark mode
[[project.theme.palette]]
media = "(prefers-color-scheme: dark)"
scheme = "slate"
toggle.icon = "lucide/moon"
toggle.name = "Switch to system preference"

Remark on syntax currently used in Lumen zensical.toml

The current Lumen zensical.toml file uses a table and sub-table hierarchy:

[[project.theme.palette]]
[project.theme.palette.toggle]

lumen/zensical.toml

Lines 117 to 126 in 562936a

# Color palette
[[project.theme.palette]]
media = "(prefers-color-scheme: light)"
scheme = "default"
primary = "custom"
accent = "blue"
[project.theme.palette.toggle]
icon = "material/brightness-7"
name = "Switch to dark mode"

I have followed that approach in file in this PR.

The Zensical doc combines the table and sub-table in one table. Should this be adopted for the Lumen file?

# Palette toggle for light mode
[[project.theme.palette]]
media = "(prefers-color-scheme: light)"
scheme = "default"
toggle.icon = "lucide/sun"
toggle.name = "Switch to dark mode"

This would apply to the theme.palette section (3 occurences) and the theme.social sections in the Lumen file (5 occurrences).

Lumen extra.social code section

lumen/zensical.toml

Lines 189 to 210 in 562936a

# Extra configuration
[project.extra]
[[project.extra.social]]
icon = "fontawesome/brands/github"
link = "https://github.com/holoviz/lumen"
[[project.extra.social]]
icon = "fontawesome/brands/discourse"
link = "https://discourse.holoviz.org/c/lumen/"
[[project.extra.social]]
icon = "fontawesome/brands/discord"
link = "https://discord.com/invite/rb6gPXbdAr"
[[project.extra.social]]
icon = "fontawesome/brands/twitter"
link = "https://twitter.com/holoviz_org"
[[project.extra.social]]
icon = "fontawesome/brands/python"
link = "https://pypi.org/project/lumen/"

Please advise, happy to make a separate PR for this.

Followed guidance in Zensical docs:

https://zensical.org/docs/setup/colors/?h=.toggle#automatic-light-dark-mode

Icon chosen from set here:

https://mui.com/material-ui/material-icons/

Assuming this set is already available in site build assets.
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.34%. Comparing base (562936a) to head (5006542).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1970   +/-   ##
=======================================
  Coverage   72.34%   72.34%           
=======================================
  Files         203      203           
  Lines       35680    35680           
=======================================
+ Hits        25812    25814    +2     
+ Misses       9868     9866    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghostiee-11

Copy link
Copy Markdown
Collaborator

@Coderambling, Can you please use this for Drafting the Pr and also prefer adding short video or images of before and after, https://github.com/holoviz-dev/holoviz-skills/tree/main/contributing-to-holoviz/skills/pr-description

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.

2 participants