Skip to content

color palette toggle phase 2 - set data- attributes - #217

Open
ntno wants to merge 34 commits into
feature/color-palette-togglefrom
feature/color-palette-toggle-phase-2
Open

color palette toggle phase 2 - set data- attributes#217
ntno wants to merge 34 commits into
feature/color-palette-togglefrom
feature/color-palette-toggle-phase-2

Conversation

@ntno

@ntno ntno commented Feb 3, 2026

Copy link
Copy Markdown
Owner
  • prepare bundled CSS palettes for data-scoping
  • set palette on html data- attribute

@ntno ntno mentioned this pull request Mar 26, 2026
@ntno
ntno marked this pull request as ready for review March 26, 2026 02:31
@ntno

ntno commented Mar 26, 2026

Copy link
Copy Markdown
Owner Author

@copilot review

Copilot AI commented Mar 26, 2026

Copy link
Copy Markdown

@copilot review

Reviewed. The main issue found was a cross-platform test failure: macOS's tidy (built from source via cmake) defaults to HTML 4.01 Strict validation and rejects data-* attributes on the <html> element, while Linux's apt-packaged tidy handles them without complaint.

Fixed in commit 2932a1b by:

  • Adding HTML5_DOCUMENT_OPTIONS = {"numeric-entities": 1, "drop-empty-elements": "no", "doctype": "html5"} to tests/utils/html.py
  • Updating test_base_template_attributes.py to use HTML5_DOCUMENT_OPTIONS (instead of ALLOW_EMPTY_ELEMENTS) when validating the full HTML5 document output from base.html

The rest of the changes look correct:

  • base.html: data-palette and data-available-palettes are properly set at build time from theme config
  • CSS palettes: all use [data-palette="name"] selectors with palette-prefixed constants in :root to avoid cross-palette variable collisions; legacy --background-color etc. aliases are preserved for backwards compatibility
  • theme.css: compatibility layer maps legacy names → namespaced vars with actual default fallbacks (no circular references)
  • styles.html: FOUC prevention script correctly runs synchronously before CSS links and validates saved palette against available options before applying

All 374 tests pass locally.

Copilot finished work on behalf of ntno March 26, 2026 02:40
ntno added 2 commits March 25, 2026 22:45
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