[Visual Refresh] Provide hooks for color palette functions #8284
+841
−245
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
Important
This PR merges into a feature branch.
This PR changes the color palette functions to support passing
colors
as argument to enable a more flexible usage outside of a React Context where the EUI default values might not be updated as expected.Additionally this PR adds hooks for the available color palette functions (e.g.
euiPaletteColorBlind
andeuiPaletteColorBlindBehindText
andeuiPaletteForStatus
etc) for usage in React components.Example added hook:
useEuiPaletteColorBlind
These hooks are mainly a devX addition and they are added to provide a direct input of the theme colors (from the
EuiProvider
to the palette functions without having to rely on the temporary middlewareEuiVisColorStore
which was previously added to support multiple themes in the previously static color palette functions.To ensure vis colors are available for custom usage with palette functions, we also need to ensure to export the vis color definitions object
colorVis
from the themes.QA
verify updated components update look the same between production and staging
verify docs update on theme changes as expected (showing updated palette colors per theme)