Yoast / yoast-components

Accessible React components by Yoast
GNU General Public License v3.0
21 stars 6 forks source link

Audit hardcoded colors and replace them with variables #748

Open afercia opened 5 years ago

afercia commented 5 years ago

Noticed while looking at https://github.com/Yoast/yoast-components/pull/703

The only way to to keep the colors palette under control in the long term, is to use only and exclusively colors variables from the palette. That's the reason why a style guide with a defined colors palette has been created.

However, over time, some colors have been hardcoded in the codebase, for example

https://github.com/Yoast/yoast-components/blob/a3f623c46ce140ebd6ea5ff9884b475b852e636a/composites/Plugin/SnippetEditor/components/Shared.js#L57-L58

where the white is a minor issue but #32373c isn't part of the Yoast palette and shouldn't be used. When there's the need for a new color, please discuss with the design team and carefully evaluate how often it will be actually used: if it's going to be used just once or twice, it's probably not really needed.

One more case of color that we've hardcoded is the #5b9dd9 blue from WordPress. as we're using it more and more, especially for the focus style, I'd propose to add it to the color palette. Alternatively, explore a way to have a sort of "JS style mixin" for the focus style that can be reused across the codebase.