Skip to content
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

[Visual Refresh] Provide hooks for color palette functions #8284

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Jan 20, 2025

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 and euiPaletteColorBlindBehindText and euiPaletteForStatus 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 middleware EuiVisColorStore 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)

    • EuiAvatar (EUI, EUI+)
    • EuiColorPalette / EuiColorPicker (EUI, EUI+)
    • EuiComboBox (EUI, EUI+)
    • elastic charts (all related subpages) (e.g. EUI - charts are not loaded as updated package with token update sin EUI+ yet)
    • EuiFacet (EUI, EUI+)
    • EuiTimeline (EUI, EUI+)

@mgadewoll mgadewoll force-pushed the eui-theme/palette-hooks branch from bf18c8e to 069aade Compare January 20, 2025 16:35
@mgadewoll mgadewoll self-assigned this Jan 20, 2025
@mgadewoll mgadewoll marked this pull request as ready for review January 20, 2025 17:19
@mgadewoll mgadewoll requested a review from a team as a code owner January 20, 2025 17:19
@tkajtoch tkajtoch self-requested a review January 21, 2025 14:29
Copy link
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

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

The changes look great! My brain had to adjust to seeing euiPaletteColorBlind-like variable names and not assume it's a function :D

@mgadewoll mgadewoll force-pushed the eui-theme/palette-hooks branch from 069aade to f45a7dc Compare January 29, 2025 06:07
@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@mgadewoll mgadewoll merged commit 84d8df3 into elastic:eui-theme/borealis Jan 29, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants