-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiStat] Allow for customization of colors #3606
Comments
Those are nice looking charts! 😍 I'll agree that we should be able to customize more colors. I've had the same thought for EuiProgress (to align to a vis color). This is one of those instances that if we do allow for colors, we should probably just allow any hex value instead of trying to account for all the colors we supply. For instance, say we eventually get to a point where users can customize the color palette for all of Kibana. We'd still want to align those stat colors with the chosen chart/palette colors. It's going to get hard to maintain all the possible color options via props and SASS. Therefore, I think the best solution to this is to ensure that it is easy for consumers to customize the color of the Stat to anything they'd like. Whether thats with CSS overrides or inline-styles added by passing a hex |
I'd like to work on this issue, How do you guys plan to let the user change the colour? |
Normally when we've done these we allow either the enum of named colors (as it works now) or a hex value. You can likely look into a couple of our components (like EuiBadge) for an example of how we validate this at the prop layer. Thanks for taking a look. |
@snide So, we could create a seperate class like |
You would likely check to see if if was one of the enums... then use a class. If a hex was used instead, apply the coloring through a style tag. |
@snide I was thinking we could even use the |
It's probably better to check if the string is a key in the enum lookup to use its className, and allow any other arbitrary strings passed through to a style tag. This gives the consuming application extra flexibility. |
@chandlerprall I've made it work in the docs, but there are some errors, I'll make a PR, we we can from there |
Closed by #3617 |
Summary
The existing
EuiStat
component allows for coloring the values by specific color variables (our default color set). We would like to use theEuiStat
as a large legend/KPI component in the Observability homepage visualizations. We want to be able to color the values by the assigned color in the visualization, which uses theeuiPaletteColorBlind
color palette.Would it be possible to allow the
euiPalette
colors to be assigned in the props? E.g. defineeuiColorVis9
as a color for value.The text was updated successfully, but these errors were encountered: