|
1 | 1 | // stylelint-disable hue-degree-notation, @stylistic/number-leading-zero |
2 | 2 |
|
| 3 | +@use "sass:map"; |
| 4 | +@use "functions" as *; |
| 5 | +@use "mixins/tokens" as *; |
| 6 | + |
3 | 7 | // Easily convert colors to oklch() with https://oklch.com/ |
4 | | -$new-blue: oklch(60% 0.24 240) !default; |
5 | | -$new-indigo: oklch(56% 0.26 288) !default; |
6 | | -$new-violet: oklch(56% 0.24 300) !default; |
7 | | -$new-purple: oklch(56% 0.24 320) !default; |
8 | | -$new-pink: oklch(60% 0.22 4) !default; |
9 | | -$new-red: oklch(60% 0.22 20) !default; |
10 | | -$new-orange: oklch(70% 0.22 52) !default; |
11 | | -$new-amber: oklch(79% 0.2 78) !default; |
12 | | -$new-yellow: oklch(88% 0.24 88) !default; |
13 | | -$new-lime: oklch(65% 0.24 135) !default; |
14 | | -$new-green: oklch(64% 0.22 160) !default; |
15 | | -$new-teal: oklch(68% 0.22 190) !default; |
16 | | -$new-cyan: oklch(69% 0.22 220) !default; |
17 | | -$new-brown: oklch(60% 0.12 54) !default; |
18 | | -$new-gray: oklch(60% 0.02 245) !default; |
19 | | -$new-pewter: oklch(65% 0.01 290) !default; |
20 | | - |
21 | | -$hues: ( |
22 | | - "blue": $new-blue, |
23 | | - "indigo": $new-indigo, |
24 | | - "violet": $new-violet, |
25 | | - "purple": $new-purple, |
26 | | - "pink": $new-pink, |
27 | | - "red": $new-red, |
28 | | - "orange": $new-orange, |
29 | | - "amber": $new-amber, |
30 | | - "yellow": $new-yellow, |
31 | | - "lime": $new-lime, |
32 | | - "green": $new-green, |
33 | | - "teal": $new-teal, |
34 | | - "cyan": $new-cyan, |
35 | | - "brown": $new-brown, |
36 | | - "gray": $new-gray, |
37 | | - "pewter": $new-pewter |
| 8 | + |
| 9 | +$white: #fff !default; |
| 10 | +$black: #000 !default; |
| 11 | + |
| 12 | +// scss-docs-start colors-list |
| 13 | +$blue: oklch(60% 0.24 240) !default; |
| 14 | +$indigo: oklch(56% 0.26 288) !default; |
| 15 | +$violet: oklch(56% 0.24 300) !default; |
| 16 | +$purple: oklch(56% 0.24 320) !default; |
| 17 | +$pink: oklch(60% 0.22 4) !default; |
| 18 | +$red: oklch(60% 0.22 20) !default; |
| 19 | +$orange: oklch(70% 0.22 52) !default; |
| 20 | +$amber: oklch(79% 0.2 78) !default; |
| 21 | +$yellow: oklch(88% 0.24 88) !default; |
| 22 | +$lime: oklch(65% 0.24 135) !default; |
| 23 | +$green: oklch(64% 0.22 160) !default; |
| 24 | +$teal: oklch(68% 0.22 190) !default; |
| 25 | +$cyan: oklch(69% 0.22 220) !default; |
| 26 | +$brown: oklch(60% 0.12 54) !default; |
| 27 | +$gray: oklch(60% 0.02 245) !default; |
| 28 | +$pewter: oklch(65% 0.01 290) !default; |
| 29 | +// scss-docs-end colors-list |
| 30 | + |
| 31 | +// scss-docs-start colors-map |
| 32 | +$colors: () !default; |
| 33 | + |
| 34 | +// stylelint-disable-next-line scss/dollar-variable-default |
| 35 | +$colors: defaults( |
| 36 | + ( |
| 37 | + "blue": $blue, |
| 38 | + "indigo": $indigo, |
| 39 | + "violet": $violet, |
| 40 | + "purple": $purple, |
| 41 | + "pink": $pink, |
| 42 | + "red": $red, |
| 43 | + "orange": $orange, |
| 44 | + "amber": $amber, |
| 45 | + "yellow": $yellow, |
| 46 | + "lime": $lime, |
| 47 | + "green": $green, |
| 48 | + "teal": $teal, |
| 49 | + "cyan": $cyan, |
| 50 | + "brown": $brown, |
| 51 | + "gray": $gray, |
| 52 | + "pewter": $pewter, |
| 53 | + ), |
| 54 | + $colors |
| 55 | +); |
| 56 | +// scss-docs-end colors-map |
| 57 | + |
| 58 | +// scss-docs-start color-mix-options |
| 59 | +$color-mix-space: lab !default; |
| 60 | +$tint-color: $white !default; |
| 61 | +$shade-color: $black !default; |
| 62 | + |
| 63 | +$color-tints: ( |
| 64 | + "025": 94%, |
| 65 | + "050": 90%, |
| 66 | + "100": 80%, |
| 67 | + "200": 60%, |
| 68 | + "300": 40%, |
| 69 | + "400": 20%, |
38 | 70 | ) !default; |
39 | 71 |
|
40 | | -:root { |
41 | | - @each $color, $hue in $hues { |
42 | | - --#{$color}-025: color-mix(in lab, #fff 94%, #{$hue}); |
43 | | - --#{$color}-050: color-mix(in lab, #fff 90%, #{$hue}); |
44 | | - --#{$color}-100: color-mix(in lab, #fff 80%, #{$hue}); |
45 | | - --#{$color}-200: color-mix(in lab, #fff 60%, #{$hue}); |
46 | | - --#{$color}-300: color-mix(in lab, #fff 40%, #{$hue}); |
47 | | - --#{$color}-400: color-mix(in lab, #fff 20%, #{$hue}); |
48 | | - --#{$color}-500: #{$hue}; |
49 | | - --#{$color}-600: color-mix(in lab, #000 16%, #{$hue}); |
50 | | - --#{$color}-700: color-mix(in lab, #000 32%, #{$hue}); |
51 | | - --#{$color}-800: color-mix(in lab, #000 48%, #{$hue}); |
52 | | - --#{$color}-900: color-mix(in lab, #000 64%, #{$hue}); |
53 | | - --#{$color}-950: color-mix(in lab, #000 76%, #{$hue}); |
54 | | - --#{$color}-975: color-mix(in lab, #000 88%, #{$hue}); |
| 72 | +$color-shades: ( |
| 73 | + "600": 16%, |
| 74 | + "700": 32%, |
| 75 | + "800": 48%, |
| 76 | + "900": 64%, |
| 77 | + "950": 76%, |
| 78 | + "975": 88%, |
| 79 | +) !default; |
| 80 | +// scss-docs-end color-mix-options |
| 81 | + |
| 82 | +// scss-docs-start color-tokens |
| 83 | +$color-tokens: () !default; |
| 84 | + |
| 85 | +$-color-defaults: () !default; |
| 86 | +@each $color, $value in $colors { |
| 87 | + @each $stop, $percent in $color-tints { |
| 88 | + $-color-defaults: map.set($-color-defaults, --#{$color}-#{$stop}, color-mix(in #{$color-mix-space}, #{$tint-color} #{$percent}, #{$value})); |
| 89 | + } |
| 90 | + $-color-defaults: map.set($-color-defaults, --#{$color}-500, #{$value}); |
| 91 | + @each $stop, $percent in $color-shades { |
| 92 | + $-color-defaults: map.set($-color-defaults, --#{$color}-#{$stop}, color-mix(in #{$color-mix-space}, #{$shade-color} #{$percent}, #{$value})); |
55 | 93 | } |
56 | 94 | } |
57 | 95 |
|
58 | | -$white: #fff !default; |
59 | | -$black: #000 !default; |
| 96 | +// stylelint-disable-next-line scss/dollar-variable-default |
| 97 | +$color-tokens: defaults($-color-defaults, $color-tokens); |
| 98 | +// scss-docs-end color-tokens |
| 99 | + |
| 100 | +:root { |
| 101 | + @include tokens($color-tokens); |
| 102 | +} |
0 commit comments