Refactoring the SCSS color palette for better reusability and maintainability #462
Replies: 3 comments
-
@0xLodz Thank you for your attention to the redesign of our colors, as it was an improvement we had to address! |
Beta Was this translation helpful? Give feedback.
-
@lolottetheclash Thanks for your feedback!
Highly likely that any colors outside of the Figma palettes would be for specialized use. Hence placing them in the component-specific CSS seems most fitting. If such colors end up needing reuse, perhaps that signals they should join the design system's color palettes. |
Beta Was this translation helpful? Give feedback.
-
Done in #475 |
Beta Was this translation helpful? Give feedback.
-
Overview
The current SCSS color palette includes various naming conventions tied to specific components and functional roles (e.g. primary, secondary...).
As the project grows and the color palettes in our design system have recently been updated, we probably need a more generic approach to make palette management more maintainable.
Here is a proposal to improve our current palette. Feel free to comment/update it, or to provide alternative proposals.
Proposed changes
Extract base colors
Extract the base colors and their variants (e.g., 100, 200, ..., 900) from the Figma file (OKP4 - Design System > Atoms > Colors).
We can use the Figma's Styler plugin.
We first need to select the colors (using
cmd + R
), then generate style using the plugin.Add base colors in the palette
Add color variables in the existing palette.scss file, extracted colors variables might look like this:
Remove Component-Specific Colors
Colors that are specifically tied to a particular component can be removed from the global color palette. Instead, it might be more appropriate to define them within the component's own SCSS file.
Gradients
For gradients, define them separately and map them to the base color variants.
Transparency
Levels of transparency are manageable using the
themed
function.Example for the blue color with 500 variant and 60% transparency:
Benefits
Reusability: The new palette will be more versatile, allowing colors to be easily reused across different components.
Maintainability: The new structure will make it easier to update or extend the color palette in the future.
Next steps
@lolottetheclash @fredericvilcot @SpicySalm0n please lmk wyt. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions