feat(desktop): custom accent color picker + smooth theme transitions#3115
Open
HUQIANTAO wants to merge 1 commit into
Open
feat(desktop): custom accent color picker + smooth theme transitions#3115HUQIANTAO wants to merge 1 commit into
HUQIANTAO wants to merge 1 commit into
Conversation
Adds two related appearance improvements: 1. Custom accent color. lib/theme.ts learns a per-user accent stored at reasonix-accent in localStorage. applyAccent() validates (#rgb or #rrggbb), derives the foreground (warm ink on light accents, white on dark) and a 14% alpha soft tint, then writes --accent/--accent-fg/ --accent-soft to the document root in a single rAF frame. The picker in SettingsPanel -> Appearance is a native <input type=color>; the reset button restores the default warm clay (#d97757). All three locales pick up the new keys (en + zh). 2. Theme transition. The body element now transitions background-color, color, and border-color over 180ms on a light/dark/auto toggle so a theme flip crossfades instead of snapping. A .theme-transitioning class is armed for two rAFs to give the browser a paint frame to capture the from-state (without the microtask hop, the change coalesces with the next paint and the transition is skipped). prefers-reduced-motion disables the transition. The transition is intentionally narrow (no transform/opacity/box-shadow) to keep streamed text and tool cards from repainting during the fade, and it doesn't run on initial mount — only on user-initiated changes from the Settings panel.
e2f94b5 to
ccd7d5c
Compare
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.
Two appearance improvements:
1. Custom accent color.
lib/theme.tslearns a per-user accent stored atreasonix-accentin localStorage.applyAccent()validates (#rgb or #rrggbb), derives the foreground (warm ink on light accents, white on dark) and a 14% alpha soft tint, then writes --accent/--accent-fg/--accent-soft to the document root in a single rAF frame. The picker in SettingsPanel → Appearance is a native<input type=color>; the reset button restores the default warm clay (#d97757). All three locales pick up the new keys.2. Theme transition. The body element now transitions background-color, color, and border-color over 180ms on a light/dark/auto toggle so a theme flip crossfades instead of snapping. A
.theme-transitioningclass is armed for two rAFs to give the browser a paint frame to capture the from-state.prefers-reduced-motiondisables the transition.