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

[Security Solution][Explore][EUI visual refresh] make sure color palettes are theme aware #202498

Open
angorayc opened this issue Dec 2, 2024 · 4 comments
Assignees
Labels
Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team
Milestone

Comments

@angorayc
Copy link
Contributor

angorayc commented Dec 2, 2024

Context

Changes are made to EUI that will be visible to end-users in Kibana:

  • Updated all colors in EUI
  • Reduce the topmost font weights and sizes (think titles and headings)
    These changes are available in a new theme called Borealis.

See parent ticket for how to use the new theme and labels to add to the PR for tracking

Description

All usage of color palette tokens and functions now pull from the theme, and correctly update to use new colors when the theme changes from Borealis to Amsterdam and vice versa.

Important

Key point: Make sure that if you are using colors from our color palette options, that your UI correctly updates to use the correct colors whenever you change themes.

https://eui.elastic.co/#/utilities/color-palettes

euiColorVis0
euiColorVis1
euiColorVis2
euiColorVis3
euiColorVis4
euiColorVis5
euiColorVis6
euiColorVis7
euiColorVis8
euiColorVis9

Vis color tokens are now available through the EUI theme: euiTheme.colors.vis:

These were not previously part of the theme. This means that they would not change when the theme was changed. They are now part of the theme and should change when the theme is changed.

If you were using any of the above tokens directly, please change your code to pull them directly from euiTheme.colors.vis.

If you were using any of our color palette functions:

  • either ensure the color palette function is called inside a React component under the EuiProvider context and is hence connected to rerender (called on rerender or connected to a state)
  • otherwise if it’s used outside of the EuiProvider context you can use the new EUI_VIS_COLOR_STORE.subscribe() function to listen to changes and update usages manually
const storeId = EUI_VIS_COLOR_STORE.subscribe(
  VIS_COLOR_STORE_EVENTS.UPDATE,
  () => {
    setPalette(euiPaletteColorBlind());
  }
);
@angorayc angorayc added Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting Security Solution Threat Hunting Team Team:Threat Hunting:Explore labels Dec 2, 2024
@angorayc angorayc added this to the 8.18 milestone Dec 2, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting-explore (Team:Threat Hunting:Explore)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@angorayc angorayc self-assigned this Dec 3, 2024
@angorayc
Copy link
Contributor Author

angorayc commented Dec 16, 2024

Todos:

  1. Found the some hard coded color hash in Lens Embeddable components. We need to modify the implementation of Lens Embeddable in order to retrieve the color token from useEuiTheme
    Our current use case, for example:

uniqueSourceIps = '#D36086',
uniqueDestinationIps = '#9170B8',
hosts = '#6092C0',

authenticationsSuccess = '#54B399',
authenticationsFailure = '#E7664C',

  1. Hard coded color schema:
    x-pack/plugins/security_solution/public/common/components/charts/donutchart_empty.tsx

https://github.com/elastic/kibana/blob/385d0dc84a5d9e77d9348aebfe59b0b2562464fc/x-pack/plugins/security_solution/public/common/components/ml/score/score_health.tsx

yConfig: [{ color: '#d36186', forAccessor: 'd9a6eb6b-8b78-439e-98e7-a718f8ffbebe' }],

yConfig: [{ color: '#d36186', forAccessor: '32f66676-f4e1-48fd-b7f8-d4de38318601' }],

Map:

https://github.com/elastic/kibana/blob/1c15e9a6774a1453b1341d406bc4b62bd8a47c4b/x-pack/plugins/security_solution/public/explore/network/components/embeddables/map_config.ts

Others:

  1. Vis colors are for visualizations only, please consider replacing them with different color tokens.
  2. Ideally color tokens should be retrieved from useEuiTheme

Rules migration:

full: euiColorVis0,
partial: euiColorVis7,
untranslatable: euiColorVis9,

alerts:

low: euiColorVis0,
medium: euiColorVis5,
high: euiColorVis7,
critical: euiColorVis9,

export const RISK_COLOR_LOW = euiLightVars.euiColorVis0;
export const RISK_COLOR_MEDIUM = euiLightVars.euiColorVis5;
export const RISK_COLOR_HIGH = euiLightVars.euiColorVis7;
export const RISK_COLOR_CRITICAL = euiLightVars.euiColorVis9;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Explore Team:Threat Hunting Security Solution Threat Hunting Team
Projects
None yet
Development

No branches or pull requests

2 participants