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

[Fleet][EUI Visual refresh] Check color palettes usage and make sure that they are theme-aware #201997

Closed
2 of 6 tasks
Tracked by #202008
criamico opened this issue Nov 27, 2024 · 1 comment · Fixed by #204070
Closed
2 of 6 tasks
Tracked by #202008
Assignees
Labels
Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@criamico
Copy link
Contributor

criamico commented Nov 27, 2024

Context

The EUI team is introducing a new theme called "Borealis". As part of this change we need to update some colors in Fleet.
See parent issue: #199715 - it also contains the instructions to run the new theme (see section Instructions for updating and QA)

Checklist

All the color palettes should now be theme aware. Details

  • Check that Fleet uses any of the following colors directly. If yes, update them to pull directly from euiTheme.colors.vis.
euiColorVis0
euiColorVis1
euiColorVis2
euiColorVis3
euiColorVis4
euiColorVis5
euiColorVis6
euiColorVis7
euiColorVis8
euiColorVis9
  • Check if Fleet is using one of the existing color palette functions (https://eui.elastic.co/#/utilities/color-palettes)
    • 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());
 }
);

➡️ There are a few instances of palette usages to check:

  1. const visColors = euiPaletteColorBlindBehindText();
    const colorToHexMap = {
    // using variables as mentioned here https://elastic.github.io/eui/#/guidelines/getting-started
    default: euiLightVars.euiColorLightShade,
    primary: visColors[1],
    success: visColors[0],
    accent: visColors[2],
    warning: visColors[5],
    danger: visColors[9],
    inactive: euiLightVars.euiColorDarkShade,
    lightest: euiLightVars.euiColorDisabled,
    };
  2. const StyledEuiColorPaletteDisplay = styled(EuiColorPaletteDisplay)`

These colors are visible in the agent list table. The new green used in Borealis (visible in the healthy label in the table) is now different than the green color used in the status bar and in the filters:

Image

Definitions of done

  • When testing the changes, test them both with the "old" Amsterdam theme and with the new Borealis theme.
  • Please label the PR with EUI Visual Refresh for cross-team visibility
@criamico criamico added the Team:Fleet Team label for Observability Data Collection Fleet team label Nov 27, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this issue Dec 19, 2024
…stic#204070)

## Summary

Closes elastic#201997

Fleet does not make proper use of [color
palettes](https://eui.elastic.co/#/utilities/color-palettes), in the
sense that [vis colors should only be used to
visualizations](elastic#199715 (comment)).

There are currently two Fleet UI elements, in the agents list table,
that use some vis colors and need to be updated:
- the status icons in the agent status summary
- the horizontal agent status bar


![image](https://github.com/user-attachments/assets/7c4500b0-1c2d-4a65-9886-3857c8210dc2)

This PR updates the function `getColorForAgentStatus`, which returns the
color based on agent status, to return theme colors with semantic
meaning aligned with the agent status badges. This will ensure colours
are aligned between agent status badges and the table header in both
Amsterdam and Borealis themes.

It should be noted that the colours used for offline and inactive status
(lightShade and darkShade), are marked as disabled, since their use
isn't properly semantic:
<img width="1012" alt="Screenshot 2024-12-16 at 15 31 00"
src="https://github.com/user-attachments/assets/ee7a185f-01d9-4139-a1ff-785a249fd882"
/>

## Screenshots

### Before (current `main`)

#### Amsterdam theme

<img width="1918" alt="fleet-agents-amsterdam-main"
src="https://github.com/user-attachments/assets/1be3ccf7-64bd-40e3-832d-b79f47345170"
/>

#### Borealis theme

<img width="1918" alt="fleet-agents-borealis-main"
src="https://github.com/user-attachments/assets/276208ed-91a8-41df-8858-53a0e7894c4a"
/>

### After

#### Amsterdam theme

<img width="1918" alt="fleet-agents-amsterdam-branch"
src="https://github.com/user-attachments/assets/e9e6ab25-f43e-4949-9e9c-8edc3443effd"
/>

#### Borealis theme

<img width="1918" alt="fleet-agents-borealis-branch"
src="https://github.com/user-attachments/assets/6ae2c3ca-9209-406f-8f46-6ee40dc77632"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants