Skip to content

feat(gnoweb): dark theme support#5145

Open
alexiscolin wants to merge 19 commits intognolang:masterfrom
alexiscolin:feat/gnoweb-darkmode
Open

feat(gnoweb): dark theme support#5145
alexiscolin wants to merge 19 commits intognolang:masterfrom
alexiscolin:feat/gnoweb-darkmode

Conversation

@alexiscolin
Copy link
Member

@alexiscolin alexiscolin commented Feb 13, 2026

This PR adds dark mode to gnoweb.

Theming infrastructure:

  • Semantic CSS tokens (--s-color-*) defined in :root for light mode and overridden in [data-theme="dark"] for dark mode. Components use tokens instead of raw colors, so theme changes are centralized.
  • A small inline script in <head> reads localStorage AND prefers-color-scheme, sets data-theme on <html> before first paint, avoiding a visible flash of the wrong theme.

3-way theme toggle

  • The toggle cycles through System → Light → Dark (instead of a binary light/dark switch).
  • System mode (the default) follows the OS prefers-color-scheme and reacts to changes in real time via a matchMedia listener.
  • Three footer icons reflect the active mode: sun (light), moon (dark), contrast circle (system).
  • The chosen preference is persisted in localStorage.

Syntax highlighting

  • Dual chroma stylesheet: friendly theme for light mode, nord for dark mode.
  • Dark chroma CSS is scoped under [data-theme="dark"] { ... } using CSS nesting, generated at runtime by WriteChromaCSS.
  • RenderConfig now supports a ChromaDarkStyle field; when nil, only light CSS is emitted.

Logo & gnome dark mode

  • The gnome icon (header, user profile, status page) is now an inline SVG template (ui/gnome) instead of an external <img>, enabling CSS variable–driven color switching.
  • The footer logo (ui/logo) uses the same CSS variables for its gnome paths.
  • Semantic tokens --s-logo-hat and --s-logo-beard are overridden in [data-theme="dark"] to match the official dark branding.
Capture d’écran 2026-02-18 à 14 30 03 Capture d’écran 2026-02-18 à 14 30 19

@github-actions github-actions bot added 📦 ⛰️ gno.land Issues or PRs gno.land package related 🌍 gnoweb Issues & PRs related to gnoweb and render labels Feb 13, 2026
@Gno2D2 Gno2D2 requested a review from gfanton February 13, 2026 08:44
@Gno2D2
Copy link
Collaborator

Gno2D2 commented Feb 13, 2026

🛠 PR Checks Summary

🔴 Changes related to gnoweb must be reviewed by its codeowners

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🔴 Changes related to gnoweb must be reviewed by its codeowners

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: alexiscolin/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Changes related to gnoweb must be reviewed by its codeowners

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 A changed file matches this pattern: ^gno.land/pkg/gnoweb/ (filename: gno.land/pkg/gnoweb/components/layouts/footer.html)

Then

🔴 Requirement not satisfied
└── 🔴 Or
    ├── 🔴 Or
    │   ├── 🔴 And
    │   │   ├── 🟢 Pull request author is user: alexiscolin
    │   │   └── 🔴 This user reviewed pull request: gfanton (with state "APPROVED")
    │   └── 🔴 And
    │       ├── 🔴 Pull request author is user: gfanton
    │       └── 🔴 This user reviewed pull request: alexiscolin (with state "APPROVED")
    └── 🔴 And
        ├── 🔴 Not (🟢 Pull request author is user: alexiscolin)
        ├── 🟢 Not (🔴 Pull request author is user: gfanton)
        └── 🔴 Or
            ├── 🔴 This user reviewed pull request: alexiscolin (with state "APPROVED")
            └── 🔴 This user reviewed pull request: gfanton (with state "APPROVED")

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gno.land/pkg/gnoweb/render.go 81.81% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@alexiscolin alexiscolin marked this pull request as ready for review February 17, 2026 08:30
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

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

A few graphical nits:

  • The icon is quite small on some screen sizes, too small sometimes:
Image
  • It doesn't update the icon when clicked
Screencast.From.2026-02-17.18-25-11.mp4

(only updates when refreshed).

Love this <3

@thehowl
Copy link
Member

thehowl commented Feb 17, 2026

Also, some colors in syntax highlighting have become harder to read:

image

@alexiscolin
Copy link
Member Author

alexiscolin commented Feb 18, 2026

Thank you, @thehowl. I updated the PR with some of your suggestions.

  • I added a new chroma style for the dark theme,
  • I fixed the icon (TypeScript declaration issue), which now updates when clicked.
  • I also added a third state for the default browsing in the button; this was the case by default, but it didn't update after clicking the theme button.
  • Additionally, I resolved some issues with the logo image, which was a bit trickier.

However, I cannot reproduce the icon size issue. Could you please provide the screen size and browser you used?

EDIT: I assume you are using Firefox. I just made a fix for the icon size.

@alexiscolin
Copy link
Member Author

alexiscolin commented Feb 18, 2026

Capture d’écran 2026-02-18 à 14 30 19 Capture d’écran 2026-02-18 à 14 30 03 Capture d’écran 2026-02-18 à 14 31 08

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

Labels

🌍 gnoweb Issues & PRs related to gnoweb and render 📦 ⛰️ gno.land Issues or PRs gno.land package related

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants

Comments