Skip to content

feat(theme): add switches, segmented controls, smart reset and search - #1831

Merged
eythaann merged 2 commits into
eythaann:masterfrom
malashkadev:feat/theme-boolean-switches
Sep 20, 2026
Merged

eythaann merged 2 commits into
eythaann:masterfrom
malashkadev:feat/theme-boolean-switches

Conversation

@malashkadev

Copy link
Copy Markdown
Contributor

Summary

This PR improves theme variable customization in the Settings app:

  1. Boolean Switches (<Switch />):

    • Added support for <boolean> syntax in core definition, typescript types and @property styles.
    • Automatically detects binary options ([1, 0], [1.0, 0.0], ["true", "false"], ["on", "off"], ["enabled", "disabled"]) or numeric ranges with min: 0, max: 1 in existing themes and renders them as modern toggle switches.
  2. Segmented Controls (<Segmented />):

    • Renders compact lists of 2–5 short options (e.g. left | center | right) as inline tabs for 1-click switching instead of bulky dropdown menus.
  3. Smart Reset Button:

    • The reset button is now disabled when the setting is at its default value (initialValue).
    • Activates only when modified by the user.
  4. Modified Indicator:

    • Added a subtle blue dot next to customized parameters to clearly show which settings were changed.
    • Tooltip localized across all 72 supported languages (resources.modified).
  5. Live Search Filter:

    • Quick search input in the theme header with deep recursive filtering across labels, descriptions, tips, and CSS variable names, with result counter and empty state.
image image
Recording_19_09_2026_20_13_39.mp4

@greptile-apps

greptile-apps Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not safe to merge until ThemeView invokes hooks consistently across missing and available theme states.

Summary

This PR extends theme configuration with boolean definitions and richer controls, adds recursive theme-setting search, tracks modified values for reset behavior, and supplies the new modified label across translations.

  • Adds <boolean> support to Rust theme definitions and generated CSS properties.
  • Detects switch and segmented-control candidates in the settings UI.
  • Adds modified-state indicators and conditional reset controls.
  • Adds recursive filtering, result counts, and an empty search state.
  • The new search page has a hook-ordering failure, and explicit boolean defaults are compared using inconsistent representations.

Reviews (1) · Last reviewed commit: "feat(theme): add switches, segmented con..."

Comment thread src/ui/react/settings/modules/resources/Theme/View.tsx Outdated
Comment thread src/ui/react/settings/modules/resources/Theme/components/ThemeSetting.tsx Outdated
@malashkadev
malashkadev force-pushed the feat/theme-boolean-switches branch from 392c092 to 4dd874c Compare September 19, 2026 17:23

@eythaann eythaann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the requested changes, and remove the unnecessary mappings.

Comment thread libs/core/src/state/theme/mod.ts Outdated
if (!isValidCssVariableName(def.name)) {
return;
}
const syntax = def.syntax === "<boolean>" ? "*" : def.syntax;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax on boolean should be mapped to <number>

falseVal: string;
}

function detectBooleanOptions(options: unknown[]): BooleanPair | null {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this, adds a behavior that is not expected on the settings definition.

}

function isSwitchSetting(definition: ThemeVariableDefinition): boolean {
if (definition.options && detectBooleanOptions(definition.options)) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, remove this


switch (definition.syntax) {
case "<boolean>": {
const isChecked = userStoredValue != null

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here value is boolean no doesn't need a mapping functions, just compare direct checked = userStoredValue === "1"

@malashkadev

Copy link
Copy Markdown
Contributor Author

Done!

@eythaann
eythaann merged commit 0220b26 into eythaann:master Sep 20, 2026
4 checks passed
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