qin
2025-03-31 8371d124f9ea5c5e898818784a2fd5e669fa7d83
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
@use 'sass:map';
@use 'sass:math';
@use 'sass:color';
 
@use '../common/var.scss' as common;
@use '../mixins/mixins.scss' as *;
@use '../color/index.scss' as *;
$colors: () !default;
 
@each $type in common.$types {
    $colors: map.deep-merge(
        (
            $type: (
                'base': map.get(common.$colors, $type, 'base'),
            ),
        ),
        $colors
    ) !global;
}
 
// https://sass-lang.com/documentation/values/maps#immutability
// mix colors with white/black to generate light/dark level
@mixin set-color-mix-level($type, $number, $mode: 'light', $mix-color: $color-white) {
    // hex mix color
    $colors: map.deep-merge(
        (
            $type: (
                '#{$mode}-#{$number}': color.mix($mix-color, map.get($colors, $type, 'base'), math.percentage(math.div($number, 10))),
            ),
        ),
        $colors
    ) !global;
 
    // for designer to view transparent
    // $colors: map.deep-merge(
    //   (
    //     $type: (
    //       '#{$mode}-#{$number}':
    //         rgba(map.get($colors, $type, 'base'), math.div(10 - $number, 10)),
    //     ),
    //   ),
    //   $colors
    // ) !global;
}
 
// Background
$bg-color: () !default;
$bg-color: map.merge(
    (
        'page': #0a0a0a,
        '': #141414,
        'overlay': #1d1e1f,
    ),
    $bg-color
);
 
// dark-mode
@each $type in common.$types {
    @for $i from 1 through 9 {
        @include set-color-mix-level($type, $i, 'light', map.get($bg-color, ''));
    }
}
@each $type in common.$types {
    @include set-color-mix-level($type, 2, 'dark', common.$color-white);
}
 
// border
$border-color-base: #f5f8ff;
$border-color: () !default;
$border-color: map.merge(
    (
        'darker': rgba($border-color-base, 0.35),
        'dark': rgba($border-color-base, 0.3),
        '': rgba($border-color-base, 0.25),
        'light': rgba($border-color-base, 0.2),
        'lighter': rgba($border-color-base, 0.15),
        'extra-light': rgba($border-color-base, 0.1),
    ),
    $border-color
);
 
// mix to hex to avoid overlay issues
@each $key, $val in $border-color {
    $border-color: map.merge(
        $border-color,
        (
            $key: mix-overlay-color($val, map.get($bg-color, '')),
        )
    ) !global;
}
 
// Box-shadow
$box-shadow: () !default;
$box-shadow: map.merge(
    (
        '': (
            0px 12px 32px 4px rgba(0, 0, 0, 0.36),
            0px 8px 20px rgba(0, 0, 0, 0.72),
        ),
        'light': (
            0px 0px 12px rgba(0, 0, 0, 0.72),
        ),
        'lighter': (
            0px 0px 6px rgba(0, 0, 0, 0.72),
        ),
        'dark': (
            0px 16px 48px 16px rgba(0, 0, 0, 0.72),
            0px 12px 32px #000000,
            0px 8px 16px -8px #000000,
        ),
    ),
    $box-shadow
);
 
// fill
$fill-color-base: #fafcff;
$fill-color: () !default;
$fill-color: map.merge(
    (
        'darker': rgba($fill-color-base, 0.2),
        'dark': rgba($fill-color-base, 0.16),
        '': rgba($fill-color-base, 0.12),
        'light': rgba($fill-color-base, 0.08),
        'lighter': rgba($fill-color-base, 0.04),
        'extra-light': rgba($fill-color-base, 0.02),
        'blank': transparent,
    ),
    $fill-color
);
 
// mix to hex to avoid overlay issues
@each $key, $val in $fill-color {
    @if ($key != 'blank') {
        $fill-color: map.merge(
            $fill-color,
            (
                $key: mix-overlay-color($val, map.get($bg-color, '')),
            )
        ) !global;
    }
}
 
// text
$text-color-base: #f0f5ff;
$text-color: () !default;
$text-color: map.merge(
    (
        'primary': rgba($text-color-base, 0.95),
        'regular': rgba($text-color-base, 0.85),
        'secondary': rgba($text-color-base, 0.65),
        'placeholder': rgba($text-color-base, 0.55),
        'disabled': rgba($text-color-base, 0.4),
    ),
    $text-color
);
// mix to hex to avoid overlay issues
@each $key, $val in $text-color {
    $text-color: map.merge(
        $text-color,
        (
            $key: mix-overlay-color($val, map.get($bg-color, '')),
        )
    ) !global;
}
 
// mask
$mask-color: () !default;
$mask-color: map.merge(
    (
        '': rgba(0, 0, 0, 0.8),
        'extra-light': rgba(0, 0, 0, 0.3),
    ),
    $mask-color
);
 
// Button
// css3 var in packages/theme-chalk/src/button.scss
$button: () !default;
$button: map.merge(
    (
        'disabled-text-color': rgba(255, 255, 255, 0.5),
    ),
    $button
);
 
// card
$card: () !default;
$card: map.merge(
    (
        'bg-color': getCssVar('bg-color', 'overlay'),
    ),
    $card
);
 
// Empty
// css3 var in packages/theme-chalk/src/empty.scss
$empty: () !default;
$empty: map.merge(
    (
        'fill-color-0': getCssVar('color-black'),
        'fill-color-1': #4b4b52,
        'fill-color-2': #36383d,
        'fill-color-3': #1e1e20,
        'fill-color-4': #262629,
        'fill-color-5': #202124,
        'fill-color-6': #212224,
        'fill-color-7': #1b1c1f,
        'fill-color-8': #1c1d1f,
        'fill-color-9': #18181a,
    ),
    $empty
);