Skip to content

Commit 8ed82f3

Browse files
committed
feat: Generate some CSS rules
1 parent 36bc717 commit 8ed82f3

File tree

2 files changed

+34
-46
lines changed

2 files changed

+34
-46
lines changed

assets/sass/_variables.scss

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@ $bg-code: #fff284;
1414
$color-onLight: #000000;
1515
$color-table-border: #5b5b5b;
1616

17+
$tag-colors: (
18+
success: #155724,
19+
warning: #b64900,
20+
error: #b70000,
21+
info: #004085,
22+
);
23+
24+
$tag-colors-dark: (
25+
success: #a8d5ba,
26+
warning: #f0d98d,
27+
error: #f5a9ae,
28+
info: #a8d5f5,
29+
);
30+
1731
html {
1832
--pagefind-ui-scale: 1 !important;
1933
--pagefind-ui-text: #000;
@@ -27,18 +41,13 @@ html {
2741
--color-onLight: #{$color-onLight};
2842
--color-table-border: #{$color-table-border};
2943
--color-body: rgb(33, 37, 41);
30-
--tag-success-bg: #d4edda;
31-
--tag-success-color: #155724;
32-
--tag-success-border: #c3e6cb;
33-
--tag-warning-bg: #fff3cd;
34-
--tag-warning-color: #856404;
35-
--tag-warning-border: #ffeaa7;
36-
--tag-error-bg: #f8d7da;
37-
--tag-error-color: #721c24;
38-
--tag-error-border: #f5c6cb;
39-
--tag-info-bg: #cce7ff;
40-
--tag-info-color: #004085;
41-
--tag-info-border: #b3d9ff;
44+
45+
@each $name, $color in $tag-colors {
46+
--tag-#{$name}-bg: #{mix(white, $color, 90%)};
47+
--tag-#{$name}-color: #{$color};
48+
--tag-#{$name}-border: #{mix(white, $color, 50%)};
49+
}
50+
4251
--border-radius-s: 0.4rem;
4352
--border-radius-m: 0.8rem;
4453
--border-radius-l: 1.6rem;
@@ -73,18 +82,13 @@ html[data-theme="dark"] {
7382
--color-onLight: #ffffff;
7483
--color-table-border: #555;
7584
--color-body: #e0e0e0;
76-
--tag-success-bg: #1a4d2e;
77-
--tag-success-color: #a8d5ba;
78-
--tag-success-border: #2d6a4f;
79-
--tag-warning-bg: #4a3a1a;
80-
--tag-warning-color: #f0d98d;
81-
--tag-warning-border: #6b5520;
82-
--tag-error-bg: #4a1a1a;
83-
--tag-error-color: #f5a9ae;
84-
--tag-error-border: #6b2d2d;
85-
--tag-info-bg: #1a3a5c;
86-
--tag-info-color: #a8d5f5;
87-
--tag-info-border: #2d5a8b;
85+
86+
@each $name, $color in $tag-colors-dark {
87+
--tag-#{$name}-bg: #{mix(black, $color, 65%)};
88+
--tag-#{$name}-color: #{$color};
89+
--tag-#{$name}-border: #{mix(black, $color, 50%)};
90+
}
91+
8892
--pagefind-ui-border: #555;
8993
--box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.5);
9094
--box-shadow-light: 0.4rem 0.4rem 0.4rem rgba(0, 0, 0, 0.3);

assets/sass/trainCategory.scss

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,12 @@
4141
font-weight: 500;
4242
white-space: nowrap;
4343

44-
&--success {
45-
background: var(--tag-success-bg);
46-
color: var(--tag-success-color);
47-
border: 0.1rem solid var(--tag-success-border);
48-
}
49-
50-
&--warning {
51-
background: var(--tag-warning-bg);
52-
color: var(--tag-warning-color);
53-
border: 0.1rem solid var(--tag-warning-border);
54-
}
55-
56-
&--error {
57-
background: var(--tag-error-bg);
58-
color: var(--tag-error-color);
59-
border: 0.1rem solid var(--tag-error-border);
60-
}
61-
62-
&--info {
63-
background: var(--tag-info-bg);
64-
color: var(--tag-info-color);
65-
border: 0.1rem solid var(--tag-info-border);
44+
@each $name, $color in $tag-colors {
45+
&--#{$name} {
46+
background: var(--tag-#{$name}-bg);
47+
color: var(--tag-#{$name}-color);
48+
border: 0.1rem solid var(--tag-#{$name}-border);
49+
}
6650
}
6751
}
6852

0 commit comments

Comments
 (0)