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] Setup semantic color tokens #8097

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Oct 23, 2024

Summary

closes https://github.com/elastic/eui-private/issues/125
closes https://github.com/elastic/eui-private/issues/126

This PR implements the base setup for colors tokens. The main idea is to remove our dependency on color calculations and use direct token values instead. To ensure this works in both themes we lift the old color calculations up to the theme definitions level.
Additionally all existing tokens are kept to ensure backwards compatibility and the values were updated for the new theme to match expected output.

The token naming is mapped to variables in Figma.

The implemented theme structure:

{
  colors, <- updated with more tokens
  base,
  size,
  border,
  font,
  animation,
  breakpoint,
  levels,
  focus,
  components <- NEW
}

The colors key now holds a lot more color tokens. These new tokens are (grouped):

  • semantic colors tokens (e.g. primary10 and shade10)
  • background tokens
  • border tokens

The components key contains:

  • buttons key which holds button specific tokens
  • forms key which holds form specific tokens
  • component specific tokens that were currently needed to resolve calculations and support old and new theme values

Changes

  • implements primitive colors for the new theme
  • implements semantic color tokens for base and common colors
  • updates existing tokens with new values in the new theme
  • adds components key on the EuiTheme and adds component specific color tokens
  • removes usages of color calculations like shade and tint and transparentize (where possible and/or necessary at this time) by adding tokens instead
  • updates shared mixin functionality of euiBackgroundColor, euiBorderColor, euiButtonColor, euiButtonFilledColor and euiButtonEmptyColor to return tokens
  • adds new color variant accentSecondary (currently enabled as background color)
  • adds color variant accentSecondary to relevant components

Important

This update does not include an update to the static JSON token files.

QA

  • CI passes
  • review theme tokens compared to design (if design hasn't changed 3 times again by then)
  • generally review Storybook and docs in the new theme if there are any unexpected styles

@mgadewoll mgadewoll force-pushed the eui-theme/125-126-semantic-color-tokens branch from 311817a to 641159f Compare October 24, 2024 07:26
@mgadewoll mgadewoll force-pushed the eui-theme/125-126-semantic-color-tokens branch from 1beabf2 to c980206 Compare October 25, 2024 08:04
@mgadewoll mgadewoll marked this pull request as ready for review October 25, 2024 15:48
@mgadewoll mgadewoll requested a review from a team as a code owner October 25, 2024 15:48
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. Considering it's targetting a feature branch I don't have any objections

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

@tkajtoch
Copy link
Member

I'm happy with the latest changes. LGTM!

@mgadewoll mgadewoll merged commit 7fb06ae into elastic:eui-theme/borealis Oct 31, 2024
4 checks passed
@mgadewoll mgadewoll deleted the eui-theme/125-126-semantic-color-tokens branch October 31, 2024 15:27
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