Skip to content

Commit b9418ca

Browse files
feat(material/core): add option to configure prefix of system variables
1 parent 0106420 commit b9418ca

File tree

4 files changed

+178
-156
lines changed

4 files changed

+178
-156
lines changed

src/material/core/theming/_config-validation.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
@if $err {
9090
@return (#{'$config should be a color configuration object. Got:'} $config);
9191
}
92-
$allowed: (theme-type, primary, tertiary, use-system-variables);
92+
$allowed: (theme-type, primary, tertiary, use-system-variables, system-variables-prefix);
9393
$err: validation.validate-allowed-values(map.keys($config or ()), $allowed...);
9494
@if $err {
9595
@return (
@@ -134,7 +134,8 @@
134134
bold-weight,
135135
medium-weight,
136136
regular-weight,
137-
use-system-variables
137+
use-system-variables,
138+
system-variables-prefix
138139
);
139140
$err: validation.validate-allowed-values(map.keys($config or ()), $allowed...);
140141
@if $err {

src/material/core/theming/_definition.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ $theme-version: 1;
4040
$type: map.get($config, theme-type) or light;
4141
$primary: map.get($config, primary) or palettes.$violet-palette;
4242
$tertiary: map.get($config, tertiary) or $primary;
43+
$system-variables-prefix: map.get($config, system-variables-prefix) or sys;
4344
sass-utils.$use-system-color-variables: map.get($config, use-system-variables) or false;
4445

4546
@return (
@@ -55,7 +56,7 @@ $theme-version: 1;
5556
error: map.get($primary, error),
5657
),
5758
color-tokens: m3-tokens.generate-color-tokens(
58-
$type, $primary, $tertiary, map.get($primary, error))
59+
$type, $primary, $tertiary, map.get($primary, error), $system-variables-prefix)
5960
)
6061
);
6162
}
@@ -74,6 +75,7 @@ $theme-version: 1;
7475
$bold: map.get($config, bold-weight) or 700;
7576
$medium: map.get($config, medium-weight) or 500;
7677
$regular: map.get($config, regular-weight) or 400;
78+
$system-variables-prefix: map.get($config, system-variables-prefix) or sys;
7779
sass-utils.$use-system-typography-variables: map.get($config, use-system-variables) or false;
7880

7981
@return (
@@ -87,7 +89,7 @@ $theme-version: 1;
8789
regular: $regular,
8890
),
8991
typography-tokens: m3-tokens.generate-typography-tokens(
90-
$brand, $plain, $bold, $medium, $regular)
92+
$brand, $plain, $bold, $medium, $regular, $system-variables-prefix)
9193
)
9294
);
9395
}

0 commit comments

Comments
 (0)