Skip to content

Commit

Permalink
classify colors, rename default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Jul 5, 2024
1 parent 80282c5 commit 0b2734e
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/css/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* use a custom property that wasn't defined.
*/

@use "../../build/tokens/scss/tokens.default.scss" as t;
@use "../../build/tokens/scss/tokens.light.scss" as t;
@use "sass:list";
@use "sass:map";
@use "sass:math";
Expand Down
4 changes: 2 additions & 2 deletions src/css/base/_general.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ body {
font-family: f.font-family(main);
font-size: f.base-size();
line-height: f.lines(1);
color: f.color(text);
background: f.color(background);
color: f.color(text, default);
background: f.color(background, foundation);
}

@media screen and (prefers-reduced-motion: reduce) {
Expand Down
5 changes: 0 additions & 5 deletions src/css/themes/_default.scss

This file was deleted.

2 changes: 1 addition & 1 deletion src/css/themes/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@use "default";
@use "light";
@use "dark";
5 changes: 5 additions & 0 deletions src/css/themes/light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@use "../../../build/tokens/scss/mixin.light" as tm;

:root {
@include tm.tokens;
}
31 changes: 27 additions & 4 deletions src/tokens/color/theme.dark.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,32 @@
export default {
color: {
$type: "color",
text: { $value: "{color.base.white}" },
primary: { $value: "{color.base.white}" },
secondary: { $value: "{color.base.white}" },
background: { $value: "{color.base.black}" },
text: {
default: {
$value: "{color.base.white}",
},
primary: {
$value: "{color.base.white}",
},
},
background: {
foundation: {
$value: "{color.base.black}",
},
primary: {
$value: "{color.base.black}",
},
secondary: {
$value: "{color.base.black}",
},
},
border: {
primary: {
$value: "{color.base.white}",
},
secondary: {
$value: "{color.base.white}",
},
},
},
};
12 changes: 0 additions & 12 deletions src/tokens/color/theme.default.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/tokens/color/theme.light.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Colors for the light theme. You can add more themes by adding files named
// `theme.{name}.js`.

export default {
color: {
$type: "color",
text: {
default: {
$value: "{color.base.black}",
},
primary: {
$value: "{color.base.black}",
},
},
background: {
foundation: {
$value: "{color.base.white}",
},
primary: {
$value: "{color.base.white}",
},
secondary: {
$value: "{color.base.white}",
},
},
border: {
primary: {
$value: "{color.base.black}",
},
secondary: {
$value: "{color.base.black}",
},
},
},
};
2 changes: 1 addition & 1 deletion src/tokens/size/other.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
},
internal: {
size: {
$type: "dimension",
$type: "number",
spacer: {
factors: {
$value: [1, 2, 3, 4, 5, 6, 7, 8],
Expand Down
4 changes: 2 additions & 2 deletions style-dictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import StyleDictionary from "style-dictionary";
import { fileHeader, formattedVariables } from "style-dictionary/utils";

/*
Set themes here. The SCSS code uses the default theme to define the accessor
Set themes here. The SCSS code uses the light theme to define the accessor
functions. Token files for a specific theme should be named `*.{theme}.json` or
`*.{theme}.js`. Files without the theme in the name are included in all themes.
When you add a theme, you will also need to add a theme file to `src/css/themes`
and use it in `src/css/themes/_index.scss`.
*/
const themes = ["default", "dark"];
const themes = ["light", "dark"];

const isInternal = (token) => {
return token.attributes.category == "internal";
Expand Down

0 comments on commit 0b2734e

Please sign in to comment.