|
9 | 9 | --@{prefix}@{id}-rgb: #lib.rgbify(@color)[]; |
10 | 10 | } |
11 | 11 |
|
| 12 | + .token-content(@id, @color, @content) { |
| 13 | + --@{prefix}@{id}: @color; |
| 14 | + --@{prefix}@{id}-rgb: #lib.rgbify(@color)[]; |
| 15 | + |
| 16 | + --@{prefix}on-@{id}: @content; |
| 17 | + --@{prefix}on-@{id}-rgb: #lib.rgbify(@content)[]; |
| 18 | + } |
| 19 | + |
| 20 | + .token-content-container(@id, @color, @content) { |
| 21 | + .token-content(@id, @color, @content); |
| 22 | + |
| 23 | + --@{prefix}@{id}-container: mix(@color, @base, @m3-tint); |
| 24 | + --@{prefix}@{id}-container-rgb: #lib.rgbify(mix(@color, @base, @m3-tint))[]; |
| 25 | + --@{prefix}on-@{id}-container: lighten(@color, @m3-emphasize); |
| 26 | + --@{prefix}on-@{id}-container-rgb: #lib.rgbify(lighten(@color, @m3-emphasize))[]; |
| 27 | + } |
| 28 | + |
12 | 29 | .base() { |
13 | 30 | @m3-primary: @accent; |
14 | 31 | @m3-secondary: desaturate(@accent, 30%); |
15 | 32 | @m3-tertiary: lighten(@accent, 5%); |
| 33 | + |
| 34 | + @m3-fixed-primary: @m3-fixed-flavor[@@accentColor]; |
| 35 | + @m3-fixed-secondary: desaturate(@m3-fixed-flavor[@@accentColor], 30%); |
| 36 | + @m3-fixed-tertiary: lighten(@m3-fixed-flavor[@@accentColor], 5%); |
| 37 | + @m3-fixed-on-accent: @m3-fixed-flavor[@base]; |
| 38 | + |
| 39 | + @m3-fixed-flavor: @catppuccin[@mocha]; |
| 40 | + |
16 | 41 | @m3-emphasize: if(@flavor = latte, -30%, 12.5%); |
17 | 42 | @m3-deemphasize: 10%; |
18 | 43 | @m3-tint: if(@flavor = latte, 25%, 30%); |
19 | 44 |
|
20 | 45 | @m3-inverse-flavor: if(@flavor = latte, mocha, latte); |
21 | | - @m3-black: @catppuccin[@mocha][@crust]; |
| 46 | + @m3-black: @m3-fixed-flavor[@crust]; |
22 | 47 | } |
23 | 48 |
|
24 | 49 | .with-prefix(@prefix) { |
25 | 50 | // Container should be mixed with base, instead of using opacity. |
| 51 | + .token-content-container(error, @red, @base); |
| 52 | + .token-content-container(primary, @m3-primary, @base); |
| 53 | + .token-content-container(secondary, @m3-secondary, @base); |
| 54 | + .token-content-container(tertiary, @m3-tertiary, @base); |
26 | 55 |
|
27 | | - .token(error, @red); |
28 | | - .token(error-container, mix(@red, @base, @m3-tint)); |
29 | | - .token(inverse-on-surface, @base); |
30 | | - // m3-primary |
31 | | - .token(inverse-primary, @catppuccin[@@m3-inverse-flavor][@@accentColor]); |
32 | | - .token(inverse-surface, @text); |
33 | | - .token(on-background, @text); |
34 | | - .token(on-error, @base); |
35 | | - .token(on-error-container, lighten(@red, @m3-emphasize)); |
36 | | - .token(on-primary, @base); |
37 | | - .token(on-primary-container, lighten(@m3-primary, @m3-emphasize)); |
38 | | - .token(on-primary-fixed, @catppuccin[@mocha][@base]); |
39 | | - .token(on-primary-fixed-variant, @catppuccin[@mocha][@base]); |
40 | | - .token(on-secondary, @base); |
41 | | - .token(on-secondary-container, lighten(@m3-secondary, @m3-emphasize)); |
42 | | - .token(on-secondary-fixed, @catppuccin[@mocha][@base]); |
43 | | - .token(on-secondary-fixed-variant, @catppuccin[@mocha][@base]); |
44 | | - .token(on-surface, @text); |
45 | | - .token(on-surface-variant, @subtext0); |
46 | | - .token(on-tertiary, @base); |
47 | | - .token(on-tertiary-container, lighten(@m3-tertiary, @m3-emphasize)); |
48 | | - .token(on-tertiary-fixed, @catppuccin[@mocha][@base]); |
49 | | - .token(on-tertiary-fixed-variant, @catppuccin[@mocha][@base]); |
50 | | - .token(outline, @overlay2); |
51 | | - .token(outline-variant, @overlay0); |
52 | | - .token(primary, @m3-primary); |
53 | | - .token(primary-container, mix(@m3-primary, @base, @m3-tint)); |
54 | | - // m3-primary |
55 | | - .token(primary-fixed, @catppuccin[@mocha][@@accentColor]); |
56 | | - // m3-primary |
57 | | - .token( |
58 | | - primary-fixed-dim, |
59 | | - darken(@catppuccin[@mocha][@@accentColor], @m3-deemphasize), |
60 | | - ); |
61 | | - .token(scrim, @m3-black); |
62 | | - .token(secondary, @m3-secondary); |
63 | | - .token(secondary-container, mix(@m3-secondary, @base, @m3-tint)); |
64 | | - // m3-secondary |
65 | | - .token( |
66 | | - secondary-fixed, |
67 | | - desaturate(@catppuccin[@mocha][@@accentColor], 15%), |
68 | | - ); |
69 | | - // m3-secondary |
70 | | - .token( |
71 | | - secondary-fixed-dim, |
72 | | - darken( |
73 | | - desaturate(@catppuccin[@mocha][@@accentColor], 15%), |
74 | | - @m3-deemphasize |
75 | | - ), |
76 | | - ); |
77 | | - .token(shadow, @m3-black); |
| 56 | + // Fixed variants |
| 57 | + .token-content(primary-fixed, @m3-fixed-primary, @m3-fixed-on-accent); |
| 58 | + .token(on-primary-fixed-variant, @m3-fixed-on-accent); |
| 59 | + .token(primary-fixed-dim, darken(@m3-fixed-primary, @m3-deemphasize)); |
| 60 | + |
| 61 | + .token-content(secondary-fixed, @m3-fixed-secondary, @m3-fixed-on-accent); |
| 62 | + .token(on-secondary-fixed-variant, @m3-fixed-on-accent); |
| 63 | + .token(secondary-fixed-dim, darken(@m3-fixed-secondary, @m3-deemphasize)); |
78 | 64 |
|
| 65 | + .token-content(tertiary-fixed, @m3-fixed-tertiary, @m3-fixed-on-accent); |
| 66 | + .token(on-tertiary-fixed-variant, @m3-fixed-on-accent); |
| 67 | + .token(tertiary-fixed-dim, darken(@m3-fixed-tertiary, @m3-deemphasize)); |
| 68 | + |
| 69 | + // Elevation scale |
79 | 70 | .token(surface-container-lowest, @crust); |
80 | | - .token(surface, @mantle); |
81 | | - .token(background, @mantle); |
| 71 | + .token-content(surface, @mantle, @text); |
82 | 72 | .token(surface-dim, @mantle); |
83 | 73 | .token(surface-container-low, @base); |
84 | 74 | .token(surface-container, @surface0); |
85 | 75 | .token(surface-container-high, @surface1); |
86 | 76 | .token(surface-container-highest, @surface2); |
87 | 77 | .token(surface-bright, @overlay0); |
88 | | - .token(surface-variant, @overlay1); |
89 | | - |
90 | | - .token(surface-tint, @accent); |
91 | | - .token(tertiary, @m3-tertiary); |
92 | | - .token(tertiary-container, mix(@m3-tertiary, @base, @m3-tint)); |
93 | | - // m3-tertiary |
94 | | - .token(tertiary-fixed, lighten(@catppuccin[@mocha][@@accentColor], 5%)); |
95 | | - // m3-tertiary |
96 | | - .token( |
97 | | - tertiary-fixed-dim, |
98 | | - darken(lighten(@catppuccin[@mocha][@@accentColor], 5%), @m3-deemphasize), |
99 | | - ); |
| 78 | + .token-content(surface-variant, @overlay1, @subtext0); |
| 79 | + // Elevation scale end |
| 80 | + |
| 81 | + // Inverse variants |
| 82 | + .token(inverse-primary, @catppuccin[@@m3-inverse-flavor][@@accentColor]); |
| 83 | + .token(inverse-surface, @text); |
| 84 | + .token(inverse-on-surface, @base); |
| 85 | + |
| 86 | + // Outline/Disabled text |
| 87 | + .token(outline, @overlay2); |
| 88 | + .token(outline-variant, @overlay0); |
| 89 | + |
| 90 | + // Backdrop |
| 91 | + .token(scrim, @m3-black); |
| 92 | + .token(shadow, @m3-black); |
| 93 | + |
| 94 | + // Deprecated |
| 95 | + .token-content(background, @mantle, @text); |
| 96 | + .token(surface-tint, @mauve); |
100 | 97 | } |
101 | 98 | } |
0 commit comments