Repository navigation
Respect explicit light theme - #58
Merged
Merged
Conversation
Guard system dark styles when the viewer explicitly uses LIGHT. Add regression coverage for LIGHT, DARK, AUTOMATIC, and unset modes.
alekswebnet
added a commit
that referenced
this pull request
Oct 19, 2026
Follow-ups from the review of #58: - The theme matched forced palettes by substring tests on the inline style attribute, which depend on serialization and misfire on values like `color-scheme: light dark`. The element now sets html[data-color-scheme="light|dark"] and the theme matches it exactly. - Apply the theme before PDF.js initializes, so a forced palette is in place at first paint. - Keep --hover-filter and --button-disabled-opacity in step with the chosen theme instead of viewer.css's system-scheme switch. - Add the missing --sidebar-box-shadow to the neutral forced-dark block. - Document that LIGHT and DARK override the system color scheme. - Test: check data-color-scheme and --hover-filter per mode. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
|
Released in v4.3.0. Thanks @nvi9, both for the fix and for the test that toggles the media rules directly instead of depending on the host's theme. That made it straightforward to build on in #60, where the guards now match a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
viewer-css-theme="LIGHT"is set, Paper & Ink’s dark media rules still apply whenever the system preferred dark. Wrapped both dark sections in a shared CSS guard so explicitLIGHTstays light.viewer.css already uses CSS nesting, so this change should have limited additional impact on browser compatibility.
However, in older browsers without nesting support,
AUTOMATICor an unsetviewer-css-themepreviously followed the system theme and will now remain light. ExplicitLIGHTandDARKmodes still work. If this change is not acceptable, we can use flat selectors instead to preserve automatic theme switching in older browsers, though that would require changing a bit more CSS.Validation
Checklist