-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.css
More file actions
161 lines (137 loc) · 5.38 KB
/
Copy pathfunctions.css
File metadata and controls
161 lines (137 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* functions.css
* CSS Functions (CSS Values Level 5)
* Browser support: Chromium 139+ only
*
* Advanced color manipulation functions for dynamic color transformations.
* These functions are used throughout the design system to compute colors
* from base values, ensuring consistency and enabling theming.
*/
@supports (function(--fn(--x) returns <number> { result: 0; })) {
/* ─── Blending Functions ── */
/* Shade: mix color with black by intensity percentage
* Usage: --shade(var(--color-primary), 20%)
*/
@function --shade(--color <color>, --intensity <percentage>) returns <color> {
result: color-mix(in srgb, var(--color), black var(--intensity));
}
/* Tint: mix color with white by intensity percentage
* Usage: --tint(var(--color-primary), 30%)
*/
@function --tint(--color <color>, --intensity <percentage>) returns <color> {
result: color-mix(in srgb, var(--color), white var(--intensity));
}
/* Alpha: apply opacity to color using OKLCH
* Usage: --alpha(var(--color-primary), 0.5)
*/
@function --alpha(--color <color>, --opacity <number>) returns <color> {
result: oklch(from var(--color) l c h / var(--opacity));
}
/* Surface tint: 12% color overlay for elevation effects
* Usage: --surface-tint(var(--color-primary))
*/
@function --surface-tint(--color <color>) returns <color> {
result: color-mix(in srgb, var(--color) 12%, transparent);
}
/* Border: darken color by 15% for border variants
* Usage: --border-from(var(--color-primary))
*/
@function --border-from(--color <color>) returns <color> {
result: color-mix(in srgb, var(--color), black 15%);
}
/* Border alpha: create border color from primary with transparency
* Usage: --border-alpha(var(--color-primary), 0.3)
* Light mode: primary with alpha on white
* Dark mode: primary with alpha on black
*/
@function --border-alpha(--color <color>, --opacity <number>) returns <color> {
result: oklch(from var(--color) l c h / var(--opacity));
}
/* ─── Color State Functions ── */
/* Hover state: darken color by 10% lightness
* Usage: --hover-state(var(--color-primary))
*/
@function --hover-state(--color <color>) returns <color> {
result: oklch(from var(--color) calc(l - 0.1) c h);
}
/* ─── Color Harmonies (OKLCH) ──
* Generate harmonious colors using OKLCH color space
*/
/* Secondary: +30 hue rotation from primary
* Usage: --harmony-secondary(var(--color-primary))
*/
@function --harmony-secondary(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 30));
}
/* Secondary soft: lighter, desaturated secondary
* Usage: --harmony-secondary-soft(var(--color-secondary))
*/
@function --harmony-secondary-soft(--color <color>) returns <color> {
result: oklch(from var(--color) calc(l + 0.1) calc(c * 0.5) h);
}
/* Complementary: +180 hue rotation (opposite on color wheel)
* Usage: --harmony-complementary(var(--color-primary))
*/
@function --harmony-complementary(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 180));
}
/* Analogous: adjacent colors (+30 degrees)
* Usage: --harmony-analogous-plus(var(--color-primary))
*/
@function --harmony-analogous-plus(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 30));
}
/* Analogous: adjacent colors (-30 degrees)
* Usage: --harmony-analogous-minus(var(--color-primary))
*/
@function --harmony-analogous-minus(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h - 30));
}
/* Split-complementary: +150 degrees
* Usage: --harmony-split-1(var(--color-primary))
*/
@function --harmony-split-1(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 150));
}
/* Split-complementary: +210 degrees
* Usage: --harmony-split-2(var(--color-primary))
*/
@function --harmony-split-2(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 210));
}
/* Triadic: equilateral triangle (+120 degrees)
* Usage: --harmony-triad-1(var(--color-primary))
*/
@function --harmony-triad-1(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 120));
}
/* Triadic: equilateral triangle (+240 degrees)
* Usage: --harmony-triad-2(var(--color-primary))
*/
@function --harmony-triad-2(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 240));
}
/* Square: square harmony (+90 degrees)
* Usage: --harmony-square-1(var(--color-primary))
*/
@function --harmony-square-1(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 90));
}
/* Square: square harmony (+180 degrees)
* Usage: --harmony-square-2(var(--color-primary))
*/
@function --harmony-square-2(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 180));
}
/* Square: square harmony (+270 degrees)
* Usage: --harmony-square-3(var(--color-primary))
*/
@function --harmony-square-3(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 270));
}
/* Tetradic: rectangular harmony (+60 degrees)
* Usage: --harmony-tetradic-2(var(--color-primary))
*/
@function --harmony-tetradic-2(--color <color>) returns <color> {
result: oklch(from var(--color) l c calc(h + 60));
}
}