feat: expose ColorPickerMode parameter on MudThemeManager#41
Open
nmiddelmann2106 wants to merge 1 commit into
Open
feat: expose ColorPickerMode parameter on MudThemeManager#41nmiddelmann2106 wants to merge 1 commit into
nmiddelmann2106 wants to merge 1 commit into
Conversation
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.
0c5fe35 to
355fbcf
Compare
|
4 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.



Summary
Adds a
ColorPickerModeparameter toMudThemeManager(and its internalMudThemeManagerColorItem), mirroring the existingColorPickerViewplumbing. The default stays
ColorPickerMode.RGB, so behavior isunchanged 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:…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] ColorPickerModewith default
RGB.MudThemeManagerColorItem.razor: passColorPickerModethrough tothe embedded
MudColorPicker.MudThemeManager.razor.cs: add the matching top-level parameter.MudThemeManager.razor: forward it to everyMudThemeManagerColorItemusage (27 spots).
Test plan
dotnet build src/MudBlazor.ThemeManagerclean (0 errors).ColorPickerMode=ColorPickerMode.HEXand confirm pickers open in HEX. Set
ColorPickerMode.HSLandconfirm HSL. Omit the parameter and confirm the existing RGB
behavior is preserved.
Notes
onto
wip(or close this) if a parameter add to themainlineisn't desirable right now — figured the change is small and additive
enough to be low-risk while the bigger work bakes.
ColorPickerViewis currentlyundocumented.