feat(web): add canonical theme preference - #371
Open
testikun wants to merge 1 commit into
Open
Conversation
11 tasks
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.
Problem
OpenPI Web had no package-owned theme preference. A browser-local choice would create a second source of truth and drift from the canonical
/openpi-setupcontract. This implements the canonical theme slice of #350 without overlapping PR #359's language/localStorage work.Value
Users can choose
system,light, ordarkonce through OpenPI setup, see that choice in no-argument setup status, and have every Web client render the same authoritative preference. The default follows the browser/OS color scheme.Approach
ui.webThemetoMyPiSetupConfig, defaulting and failing closed tosystem.ui_web_theme, update status/prompt/docs/defaults, and register the field in the config drift guard.WebSnapshot; the browser resolvessystemwithprefers-color-schemeand never persists a competing theme value.Validation
bun run check— passed, including the 15-field configuration contract.bun run test— passed: Node 1241 passed / 1 platform skip; Vitest 30 passed.pi listreported the single OpenPI source/tmp/openpi-issue-350, whose checkout was based on72fbba52832841cfc78c2f7e7947eeb89efc73bcplus this PR commit.ui.webTheme=darkproducedpreferences.theme=darkfrom/api/snapshotand rendered the final dark UI in an actual browser. No mock image was used. The 1280×720 screenshot is attached to the first feat(web): add persistent theme/language preferences and accessibility/mobile hardening #350 claim comment.Impact
ui.webTheme; old or invalid documents read safely assystemand are normalized on the next setup write.systemif absent.