Skip to content

feat: expose ColorPickerMode parameter on MudThemeManager#41

Open
nmiddelmann2106 wants to merge 1 commit into
MudBlazor:mainfrom
nmiddelmann2106:feature/colorpicker-mode-parameter
Open

feat: expose ColorPickerMode parameter on MudThemeManager#41
nmiddelmann2106 wants to merge 1 commit into
MudBlazor:mainfrom
nmiddelmann2106:feature/colorpicker-mode-parameter

Conversation

@nmiddelmann2106
Copy link
Copy Markdown

Summary

Adds a ColorPickerMode parameter to MudThemeManager (and its internal
MudThemeManagerColorItem), mirroring the existing ColorPickerView
plumbing. The default stays ColorPickerMode.RGB, so behavior is
unchanged unless a consumer opts in.

Motivation

Designers/devs working with brand color tokens almost always reason in
hex (#1A73E8). With this change a host app can do:

<MudThemeManager ... ColorPickerMode=ColorPickerMode.HEX />

…and every embedded color picker opens in HEX mode by default. Without
it, the only options today are forking or DOM-hacking the picker.

Changes

  • MudThemeManagerColorItem.razor.cs: add [Parameter] ColorPickerMode
    with default RGB.
  • MudThemeManagerColorItem.razor: pass ColorPickerMode through to
    the embedded MudColorPicker.
  • MudThemeManager.razor.cs: add the matching top-level parameter.
  • MudThemeManager.razor: forward it to every MudThemeManagerColorItem
    usage (27 spots).

Test plan

  • dotnet build src/MudBlazor.ThemeManager clean (0 errors).
  • Sanity: in a host app, set ColorPickerMode=ColorPickerMode.HEX
    and confirm pickers open in HEX. Set ColorPickerMode.HSL and
    confirm HSL. Omit the parameter and confirm the existing RGB
    behavior is preserved.

Notes

  • Re ThemeManager planned improvements, feedback wanted #31: I saw the larger redesign is in progress. Happy to rebase
    onto wip (or close this) if a parameter add to the main line
    isn't desirable right now — figured the change is small and additive
    enough to be low-risk while the bigger work bakes.
  • No README update; mirrors how ColorPickerView is currently
    undocumented.

Mirrors the existing ColorPickerView plumbing so consumers can choose
the default input mode (RGB / HSL / HEX) shown by the embedded
MudColorPicker without forking. Default remains ColorPickerMode.RGB
to preserve existing behavior.

- Add ColorPickerMode parameter on MudThemeManagerColorItem and pass
  through to the inner MudColorPicker.
- Add a matching parameter on MudThemeManager and forward it to every
  MudThemeManagerColorItem usage.

Use case: design-system explorer apps where users typically reason in
hex tokens (#1A73E8) - letting the host app set
ColorPickerMode=ColorPickerMode.HEX once is much friendlier than
asking users to click the mode-switch button on every color edit.
@nmiddelmann2106 nmiddelmann2106 force-pushed the feature/colorpicker-mode-parameter branch from 0c5fe35 to 355fbcf Compare May 7, 2026 09:57
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

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.

1 participant