Skip to content

Commit 9050bd7

Browse files
committed
mirror base config variables as css custom property, set aliases for some plattte colors
1 parent 1518fd5 commit 9050bd7

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

src/components/Application/_colors.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@use "sass:list";
33

44
:root {
5+
// creating css custom properties from palette colors
56
@each $palette-group-name, $palette-group-tints in $eccgui-color-palette-light {
67
@each $palette-tint-name, $palette-tint-colors in $palette-group-tints {
78
@for $i from 1 through list.length($palette-tint-colors) {
@@ -12,4 +13,18 @@
1213
}
1314
}
1415
}
16+
17+
// set aliases for base colors
18+
--#{$eccgui}-color-primary: #{$eccgui-color-primary};
19+
--#{$eccgui}-color-primary-contrast: #{$eccgui-color-primary-contrast};
20+
--#{$eccgui}-color-accent: #{$eccgui-color-accent};
21+
--#{$eccgui}-color-accent-contrast: #{$eccgui-color-accent-contrast};
22+
--#{$eccgui}-color-success-foreground: #{$eccgui-color-success-text};
23+
--#{$eccgui}-color-success-background: #{$eccgui-color-success-background};
24+
--#{$eccgui}-color-info-foreground: #{$eccgui-color-info-text};
25+
--#{$eccgui}-color-info-background: #{$eccgui-color-info-background};
26+
--#{$eccgui}-color-warning-foreground: #{$eccgui-color-warning-text};
27+
--#{$eccgui}-color-warning-background: #{$eccgui-color-warning-background};
28+
--#{$eccgui}-color-danger-foreground: #{$eccgui-color-danger-text};
29+
--#{$eccgui}-color-danger-background: #{$eccgui-color-danger-background};
1530
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* We mirror our SCSS variables here to improve availability in inline styles
3+
* and module styles without included SCSS config stack.
4+
* Colors are set in `src/components/Application/_colors.scss`.
5+
*/
6+
7+
:root {
8+
--eccgui-size-typo-caption: #{$eccgui-size-typo-caption};
9+
--eccgui-size-typo-caption-lineheight: #{$eccgui-size-typo-caption-lineheight};
10+
--eccgui-size-typo-text: #{$eccgui-size-typo-text};
11+
--eccgui-size-typo-text-lineheight: #{$eccgui-size-typo-text-lineheight};
12+
--eccgui-size-typo-subtitle: #{$eccgui-size-typo-subtitle};
13+
--eccgui-size-typo-subtitle-lineheight: #{$eccgui-size-typo-subtitle-lineheight};
14+
--eccgui-size-typo-title: #{$eccgui-size-typo-title};
15+
--eccgui-size-typo-title-lineheight: #{$eccgui-size-typo-title-lineheight};
16+
--eccgui-size-typo-headline: #{$eccgui-size-typo-headline};
17+
--eccgui-size-typo-headline-lineheight: #{$eccgui-size-typo-headline-lineheight};
18+
--eccgui-size-typo-display-1: #{$eccgui-size-typo-display-1};
19+
--eccgui-size-typo-display-1-lineheight: #{$eccgui-size-typo-display-1-lineheight};
20+
--eccgui-size-typo-display-2: #{$eccgui-size-typo-display-2};
21+
--eccgui-size-typo-display-2-lineheight: #{$eccgui-size-typo-display-2-lineheight};
22+
--eccgui-size-typo-display-3: #{$eccgui-size-typo-display-3};
23+
--eccgui-size-typo-display-3-lineheight: #{$eccgui-size-typo-display-3-lineheight};
24+
--eccgui-font-weight-light: #{$eccgui-font-weight-light};
25+
--eccgui-font-weight-regular: #{$eccgui-font-weight-regular};
26+
--eccgui-font-weight-bold: #{$eccgui-font-weight-bold};
27+
--eccgui-font-spacing-condensed: #{$eccgui-font-spacing-condensed};
28+
--eccgui-font-spacing-regular: #{$eccgui-font-spacing-regular};
29+
--eccgui-font-spacing-wide: #{$eccgui-font-spacing-wide};
30+
--eccgui-size-block-whitespace: #{$eccgui-size-block-whitespace};
31+
--eccgui-size-inline-whitespace: #{$eccgui-size-inline-whitespace};
32+
--eccgui-opacity-regular: #{$eccgui-opacity-regular};
33+
--eccgui-opacity-narrow: #{$eccgui-opacity-narrow};
34+
--eccgui-opacity-muted: #{$eccgui-opacity-muted};
35+
--eccgui-opacity-disabled: #{$eccgui-opacity-disabled};
36+
--eccgui-opacity-ghostly: #{$eccgui-opacity-ghostly};
37+
--eccgui-opacity-invisible: #{$eccgui-opacity-invisible};
38+
}

src/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// == load default configuration ===============================================
1010

1111
@import "./configuration/variables";
12+
@import "./configuration/customproperties"; // mirror config as custom properties
1213

1314
// == Necessary imports from libraries =========================================
1415

0 commit comments

Comments
 (0)