IssueRaiser

Proposal: CSS Variable Groups (as a solution to several design systems pain points)

The [whole proposal is here](https://lea.verou.me/docs/var-groups/), I have included a summary below. ## Pain points (summary) The main pain point is **aliasing**. Currently, design systems are specified as a long series of variables, e.g. `--color-green-100`, `--color-crimson-950` etc. Aliasing them to other names (e.g. semantic names such as `--color-primary` or simply shorter/simpler names) is currently author hostile, as it requires manually [aliasing every single one](https://www.radix-ui.com/themes/docs/theme/color#aliasing-colors), i.e. hundreds of declarations. Not only is this painful to do for the whole page, it makes it very hard to theme areas on the page with a different color, or pass design tokens to components. Additionally, tints and shades for each color are generated manually, even if some of them could be inferred via interpolation. Theoretically that can already be done via a series of `color-mix()` values, but it is very tedious and repetitive, especially if you want to tweak the endpoints by adding more manual values where the interpolated ones don't work well. ## Other ideas explored The following are useful in their own right, but I don’t think solve the pain points equally well. - [Custom functions](https://lea.verou.me/docs/var-groups/#custom-functions) - [CSS functions for tints and shades](https://lea.verou.me/docs/var-groups/#tint-shade) - [Dedicated syntax for design tokens with standardized names for the low level common things](https://le

Posted by LeaVerou on Feb 24, 2024, 2:20 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

ux (Other)

Proposal: CSS Variable Groups (as a solution to several design systems pain points)

LeaVerouFeb 24, 2024, 2:20 AM

The [whole proposal is here](https://lea.verou.me/docs/var-groups/), I have included a summary below. ## Pain points (summary) The main pain point is **aliasing**. Currently, design systems are specified as a long series of variables, e.g. `--color-green-100`, `--color-crimson-950` etc. Aliasing them to other names (e.g. semantic names such as `--color-primary` or simply shorter/simpler names) is currently author hostile, as it requires manually [aliasing every single one](https://www.radix-ui.com/themes/docs/theme/color#aliasing-colors), i.e. hundreds of declarations. Not only is this painful to do for the whole page, it makes it very hard to theme areas on the page with a different color, or pass design tokens to components. Additionally, tints and shades for each color are generated manually, even if some of them could be inferred via interpolation. Theoretically that can already be done via a series of `color-mix()` values, but it is very tedious and repetitive, especially if you want to tweak the endpoints by adding more manual values where the interpolated ones don't work well. ## Other ideas explored The following are useful in their own right, but I don’t think solve the pain points equally well. - [Custom functions](https://lea.verou.me/docs/var-groups/#custom-functions) - [CSS functions for tints and shades](https://lea.verou.me/docs/var-groups/#tint-shade) - [Dedicated syntax for design tokens with standardized names for the low level common things](https://le

Comments (0)

No comments yet. Start the discussion.

Comment on this issue