forked from pydata/pydata-sphinx-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_color.scss
219 lines (214 loc) · 5.42 KB
/
_color.scss
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
213
214
215
216
217
218
219
/*******************************************************************************
* master color map. Only the colors that actually differ between light and dark
* themes are specified separately.
*
* NOTE: this theme defines "info == primary" and "warning == secondary"
*/
$pst-semantic-colors: (
"primary": (
//WCAG AA compliant against dark bg
"50": #f4fbfc,
"100": #e9f6f8,
"200": #d0ecf1,
"300": #abdde6,
"400": #3fb1c5,
//WCAG AA compliant against light bg
"500": #0a7d91,
"600": #085d6c,
"700": #064752,
"800": #042c33,
"900": #021b1f,
),
"secondary": (
//WCAG AA compliant against dark bg
"50": #fbf8fe,
"100": #f6f2fe,
"200": #ece3fc,
"300": #decdfa,
"400": #b691f5,
//WCAG AA compliant against light bg
"500": #894def,
"600": #6730c5,
"700": #4e2595,
"800": #31175f,
"900": #1e0e39,
),
"info": (
"light": #276be9,
"light-bg": #eff4fd,
"dark": #79a3f2,
"dark-bg": #06245d,
),
"warning": (
"light": #f66a0a,
"light-bg": #fff8f2,
"dark": #ff9245,
"dark-bg": #652a02,
),
"success": (
"light": #00843f,
"light-bg": #ecf6f1,
"dark": #5fb488,
"dark-bg": #002f17,
),
"attention": (
"light": #f66a0a,
"light-bg": #fff8f2,
"dark": #ff9245,
"dark-bg": #652a02,
),
"danger": (
"light": #d72d47,
"light-bg": #fcf1f2,
"dark": #e78894,
"dark-bg": #4e111b,
),
"text-base": (
"light": rgb(34, 40, 50),
// gray-800
// "dark": #e5e7ea
"dark": #ced6dd,
// gray-100
),
"text-muted": (
"light": #48566b,
// gray-600
"dark": #d1d5da,
// gray-300
),
// TODO - update
"shadow":
(
// "light": rgb(216, 216, 216),
"light": rgba(0, 0, 0, 0.1),
"dark": rgba(0, 0, 0, 0.2),
),
// TODO- update (need muted and regular - this is muted)
"border":
(
"light": rgba(23, 23, 26, 0.2),
"dark": #48566b,
),
// TODO - update
"inline-code":
(
"light": rgb(232, 62, 140),
"dark": rgb(221, 158, 194),
),
// TODO - update
"target":
(
"light": rgb(251, 229, 78),
"dark": rgb(71, 39, 0),
),
// DEPTH COLORS
// background: color of the canvas / the furthest back layer
"background":
(
"light": rgb(255, 255, 255),
"dark": #14181e,
),
// on-background: provides slight contrast against background
// (by use of shadows in light theme)
"on-background":
(
"light": rgb(255, 255, 255),
"dark": #222832,
// gray-800
),
// surface: object set above the background (without shadows)
// Uses JupyterLab cell background colors in light/dark theme
"surface":
(
"light": #f3f4f5,
// gray-100
"dark": #364150,
// gray-700
),
// on_surface: object on top of surface object (without shadows)
//TODO - update
"on-surface":
(
"light": rgb(225, 225, 225),
"dark": rgb(55, 55, 55),
),
);
@mixin create-color-var($key, $value, $identifier: "") {
//$identifier is an optional variable - used for the new system
@if $identifier != "" {
--pst-color-#{$key}-#{$identifier}: #{$value};
} @else {
--pst-color-#{$key}: #{$value};
}
}
@mixin theme-colors($mode) {
@each $name, $value in $pst-semantic-colors {
// check if there is a map (i.e. multiple light/dark definitions)
@if type-of($value) == map {
// support for single light/dark colour definitions
@if map-has-key($value, $mode) {
$value: map-get($value, $mode);
@include create-color-var($name, $value);
} // support for multiple light/dark colour definitions - as our new design system
@else {
@each $key, $val in $value {
@include create-color-var($key, $val, $name);
}
}
} @else {
@include create-color-var($name, $value);
}
}
// assign the "duplicate" colors (ones that just reference other variables)
& {
--pst-color-link: var(--pst-color-primary);
--pst-color-link-hover: var(--pst-color-warning);
}
// adapt to light/dark-specific content
@if $mode == "light" {
.only-dark {
display: none !important;
}
} @else {
.only-light {
display: none !important;
}
/* Adjust images in dark mode (unless they have class .only-dark or
* .dark-light, in which case assume they're already optimized for dark
* mode).
*/
img:not(.only-dark):not(.dark-light) {
filter: brightness(0.8) contrast(1.2);
}
/* Give images a light background in dark mode in case they have
* transparency and black text (unless they have class .only-dark or .dark-light, in
* which case assume they're already optimized for dark mode).
*/
.bd-content img:not(.only-dark):not(.dark-light) {
background: rgb(255, 255, 255);
border-radius: 0.25rem;
}
// MathJax SVG outputs should be filled to same color as text.
.MathJax_SVG * {
fill: var(--pst-color-text-base);
}
}
}
/* Defaults to light mode if data-theme is not set */
html:not([data-theme]) {
@include theme-colors("light");
}
/* NOTE: @each {...} is like a for-loop
* https://sass-lang.com/documentation/at-rules/control/each
*/
@each $mode in (light, dark) {
html[data-theme="#{$mode}"] {
@include theme-colors($mode);
}
}
// assign classes too, for runtime use of theme colors
@each $name, $value in $pst-semantic-colors {
.pst-color-#{$name} {
color: var(--pst-color-#{$name});
}
}