Use theme design token CSS custom properties for dark mode variants
Description
Requires theme design tokens in GitLab for CSS custom properties gitlab-ui#2365 (closed)
Use design tokens to generate CSS custom properties for theme colors. This should remove extra SCSS output from gitlab-theme-super-sidebar
mixin, reducing CSS shipped to users. The CSS custom properties should allow for each theme to override values.
Using CSS custom properties should also allow for dark mode theme colors to override values
Pseudo code
theme_red.scss
@import '@gitlab/ui/dist/tokens/scss/tokens';
body {
&.ui-red {
--theme-color-lightest: var(--theme-red-50);
--theme-color-light: var(--theme-red-200);
--theme-color: var(--theme-red-900);
--theme-color-darkest: var(--theme-red-900);
}
}
dark_mode_overrides.scss
@import '@gitlab/ui/dist/tokens/scss/tokens.dark';
Possible steps:
- Add theme color design tokens gitlab-ui!3627 (merged)
- Use CSS custom properties for themes
- Import CSS custom properties from theme tokens
- Use local CSS custom properties for super sidebar themes
- Override CSS custom properties for each theme
- Remove
gitlab-theme-super-sidebar
mixin
- Add dark mode values for theme design tokens
- (extension) Add semantic design tokens for super sidebar themes
Edited by Scott de Jonge