feat(theme): add per-color reset button to Theme picker (@Ammarfrfr) - #8298
Open
Ammarfrfr wants to merge 1 commit into
Open
feat(theme): add per-color reset button to Theme picker (@Ammarfrfr)#8298Ammarfrfr wants to merge 1 commit into
Ammarfrfr wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds per-color reset control in Settings → Theme → Custom so a single tweaked color can be reverted to the currently selected preset without wiping other custom edits.
Changes:
- Add
resetColor()inPickerto pull preset color (ThemesList+getConfig.theme) and apply viaupdateThemeColor. - Add icon-only undo button with tooltip next to the hex input.
- Adjust picker grid columns to fit the new button.
Comment on lines
+519
to
+527
| const resetColor = () => { | ||
| const presetTheme = ThemesList.find( | ||
| (theme) => theme.name === getConfig.theme, | ||
| ); | ||
| const fallbackColor = getTheme()[props.color]; | ||
| const nextColor = presetTheme?.[props.color] ?? fallbackColor; | ||
|
|
||
| updateThemeColor(props.color, nextColor); | ||
| }; |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
frontend/src/ts/components/pages/settings/custom-setting/Theme.tsx:527
- resetColor() silently no-ops if current preset not found in ThemesList (e.g. corrupted/legacy config). Elsewhere in this file ("load from preset") the same lookup shows an error; do same here so reset is not a confusing no-op.
const resetColor = () => {
const presetTheme = ThemesList.find(
(theme) => theme.name === getConfig.theme,
);
const fallbackColor = getTheme()[props.color];
const nextColor = presetTheme?.[props.color] ?? fallbackColor;
updateThemeColor(props.color, nextColor);
};
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.
Motivation
Users often tweak individual colors and want to revert one value without losing the rest of their custom theme.
Approach
Added resetColor() in Picker which finds the current preset (getConfig.theme) and falls back to the current theme color; calls updateThemeColor() to apply.
Added an undo Button with a tooltip (balloon.text) next to the hex input and kept the existing color input/palette flow for live preview.
How to test locally
Files changed
Theme.tsx
Checklist