@nuvoui/core 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nuvoui.css +770 -731
- package/dist/nuvoui.css.map +1 -1
- package/dist/nuvoui.min.css +1 -1
- package/dist/nuvoui.min.css.map +1 -1
- package/package.json +1 -1
- package/src/styles/abstracts/_config.scss +18 -0
- package/src/styles/abstracts/_functions.scss +512 -11
- package/src/styles/base/_base.scss +4 -4
- package/src/styles/layouts/_flex.scss +1 -23
- package/src/styles/layouts/_grid.scss +0 -16
- package/src/styles/mixins-map.json +13 -15
- package/src/styles/mixins-map.scss +1 -1
- package/src/styles/themes/_theme.scss +1 -1
- package/src/styles/themes/refactored_borders.ipynb +37 -0
- package/src/styles/utilities/_borders.scss +77 -265
- package/src/styles/utilities/_colors.scss +85 -31
- package/src/styles/utilities/_display.scss +56 -7
- package/src/styles/utilities/_typography.scss +44 -35
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "sass:meta";
|
|
7
7
|
@use "sass:string" as str;
|
|
8
|
+
@use "sass:list";
|
|
9
|
+
|
|
8
10
|
@use "../abstracts/config" as VAR;
|
|
9
11
|
@use "../abstracts/functions" as FN;
|
|
10
12
|
|
|
@@ -38,13 +40,18 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
38
40
|
|
|
39
41
|
// Core Border Mixins - improved to include style and color by default
|
|
40
42
|
// SKIP Documentation
|
|
41
|
-
@mixin border($val, $style: solid, $color: var(--border-
|
|
43
|
+
@mixin border($val, $style: solid, $color: var(--border-color)) {
|
|
42
44
|
$val: FN.fix-units($val);
|
|
43
45
|
|
|
46
|
+
--border-size: #{$val};
|
|
47
|
+
|
|
44
48
|
border-width: $val;
|
|
45
49
|
@if $val != 0 {
|
|
46
50
|
border-style: $style;
|
|
47
51
|
border-color: $color;
|
|
52
|
+
|
|
53
|
+
--border-style: #{$style};
|
|
54
|
+
--border-color: #{$color};
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
|
|
@@ -53,8 +60,8 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
53
60
|
|
|
54
61
|
border-top-width: $val;
|
|
55
62
|
@if $val != 0 {
|
|
56
|
-
border-top-style: solid;
|
|
57
|
-
border-top-color: var(--border);
|
|
63
|
+
border-top-style: var(--border-style, solid);
|
|
64
|
+
border-top-color: var(--border-color);
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
|
|
@@ -63,8 +70,8 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
63
70
|
|
|
64
71
|
border-right-width: $val;
|
|
65
72
|
@if $val != 0 {
|
|
66
|
-
border-right-style: solid;
|
|
67
|
-
border-right-color: var(--border);
|
|
73
|
+
border-right-style: var(--border-style, solid);
|
|
74
|
+
border-right-color: var(--border-color);
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
|
|
@@ -73,8 +80,8 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
73
80
|
|
|
74
81
|
border-bottom-width: $val;
|
|
75
82
|
@if $val != 0 {
|
|
76
|
-
border-bottom-style: solid;
|
|
77
|
-
border-bottom-color: var(--border);
|
|
83
|
+
border-bottom-style: var(--border-style, solid);
|
|
84
|
+
border-bottom-color: var(--border-color);
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -83,8 +90,8 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
83
90
|
|
|
84
91
|
border-left-width: $val;
|
|
85
92
|
@if $val != 0 {
|
|
86
|
-
border-left-style: solid;
|
|
87
|
-
border-left-color: var(--border);
|
|
93
|
+
border-left-style: var(--border-style, solid);
|
|
94
|
+
border-left-color: var(--border-color);
|
|
88
95
|
}
|
|
89
96
|
}
|
|
90
97
|
|
|
@@ -160,319 +167,124 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
160
167
|
|
|
161
168
|
@mixin pill {
|
|
162
169
|
@include rounded(9999px);
|
|
163
|
-
}
|
|
170
|
+
}
|
|
164
171
|
|
|
165
|
-
// -----------------------------------------------
|
|
166
|
-
// UTILITY CLASSES
|
|
167
|
-
// -----------------------------------------------
|
|
168
172
|
@if FN.feature-enabled("borders") {
|
|
169
173
|
// Basic border classes (all sides)
|
|
170
|
-
.border {
|
|
174
|
+
#{VAR.$parent-selector} .border {
|
|
171
175
|
@include border(1);
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
|
|
178
|
+
// Common shortcuts for single-side borders
|
|
179
|
+
#{VAR.$parent-selector} .border-0 {
|
|
175
180
|
@include border(0);
|
|
176
181
|
}
|
|
177
182
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
#{VAR.$parent-selector} .border-t {
|
|
184
|
+
@include border-top(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
#{VAR.$parent-selector} .border-r {
|
|
188
|
+
@include border-right(1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
#{VAR.$parent-selector} .border-b {
|
|
192
|
+
@include border-bottom(1);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#{VAR.$parent-selector} .border-l {
|
|
196
|
+
@include border-left(1);
|
|
183
197
|
}
|
|
184
198
|
|
|
185
199
|
// Directional border width
|
|
186
200
|
@each $width in VAR.$border-widths {
|
|
187
|
-
.border
|
|
201
|
+
#{VAR.$parent-selector} .border-#{$width},
|
|
202
|
+
#{VAR.$parent-selector} .hover\:border-#{$width}:hover,
|
|
203
|
+
#{VAR.$parent-selector} .active\:border-#{$width}:active,
|
|
204
|
+
#{VAR.$parent-selector} .focus\:border-#{$width}:focus,
|
|
205
|
+
#{VAR.$parent-selector} .group:hover .group-hover\:border-#{$width} {
|
|
206
|
+
@include border($width);
|
|
207
|
+
}
|
|
208
|
+
#{VAR.$parent-selector} .border-t-#{$width} {
|
|
188
209
|
@include border-top($width);
|
|
189
210
|
}
|
|
190
|
-
.border-r-#{$width} {
|
|
211
|
+
#{VAR.$parent-selector} .border-r-#{$width} {
|
|
191
212
|
@include border-right($width);
|
|
192
213
|
}
|
|
193
|
-
.border-b-#{$width} {
|
|
214
|
+
#{VAR.$parent-selector} .border-b-#{$width} {
|
|
194
215
|
@include border-bottom($width);
|
|
195
216
|
}
|
|
196
|
-
.border-l-#{$width} {
|
|
217
|
+
#{VAR.$parent-selector} .border-l-#{$width} {
|
|
197
218
|
@include border-left($width);
|
|
198
219
|
}
|
|
199
220
|
}
|
|
200
221
|
|
|
201
|
-
// Common shortcuts for single-side borders
|
|
202
|
-
.border-t {
|
|
203
|
-
@include border-top(1);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.border-r {
|
|
207
|
-
@include border-right(1);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.border-b {
|
|
211
|
-
@include border-bottom(1);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.border-l {
|
|
215
|
-
@include border-left(1);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
222
|
// Border radius classes
|
|
219
|
-
.rounded {
|
|
223
|
+
#{VAR.$parent-selector} .rounded {
|
|
220
224
|
@include rounded;
|
|
221
|
-
}
|
|
222
|
-
.square {
|
|
225
|
+
}
|
|
226
|
+
#{VAR.$parent-selector} .square {
|
|
223
227
|
@include rounded(0);
|
|
224
228
|
} // Alias for no radius
|
|
225
229
|
|
|
226
230
|
@each $name, $value in VAR.$border-radii {
|
|
227
|
-
.rounded-#{$name} {
|
|
231
|
+
#{VAR.$parent-selector} .rounded-#{$name} {
|
|
228
232
|
@include rounded($value);
|
|
229
233
|
}
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
// Directional border radius
|
|
233
|
-
@each $name, $value in VAR.$border-radii {
|
|
234
|
-
.rounded-t-#{$name} {
|
|
234
|
+
#{VAR.$parent-selector} .rounded-t-#{$name} {
|
|
235
235
|
@include rounded-t($value);
|
|
236
236
|
}
|
|
237
|
-
.rounded-r-#{$name} {
|
|
237
|
+
#{VAR.$parent-selector} .rounded-r-#{$name} {
|
|
238
238
|
@include rounded-r($value);
|
|
239
239
|
}
|
|
240
|
-
.rounded-b-#{$name} {
|
|
240
|
+
#{VAR.$parent-selector} .rounded-b-#{$name} {
|
|
241
241
|
@include rounded-b($value);
|
|
242
242
|
}
|
|
243
|
-
.rounded-l-#{$name} {
|
|
243
|
+
#{VAR.$parent-selector} .rounded-l-#{$name} {
|
|
244
244
|
@include rounded-l($value);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// Individual corners
|
|
248
|
-
.rounded-tl-#{$name} {
|
|
248
|
+
#{VAR.$parent-selector} .rounded-tl-#{$name} {
|
|
249
249
|
@include rounded-tl($value);
|
|
250
250
|
}
|
|
251
|
-
.rounded-tr-#{$name} {
|
|
251
|
+
#{VAR.$parent-selector} .rounded-tr-#{$name} {
|
|
252
252
|
@include rounded-tr($value);
|
|
253
253
|
}
|
|
254
|
-
.rounded-br-#{$name} {
|
|
254
|
+
#{VAR.$parent-selector} .rounded-br-#{$name} {
|
|
255
255
|
@include rounded-br($value);
|
|
256
256
|
}
|
|
257
|
-
.rounded-bl-#{$name} {
|
|
257
|
+
#{VAR.$parent-selector} .rounded-bl-#{$name} {
|
|
258
258
|
@include rounded-bl($value);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// Pill shape (alias for full radius)
|
|
263
|
-
.pill {
|
|
263
|
+
#{VAR.$parent-selector} .pill {
|
|
264
264
|
@include pill;
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
// Border styles - these override the default solid style if needed
|
|
268
268
|
@each $style in $border-styles {
|
|
269
|
-
.border-#{$style}
|
|
269
|
+
#{VAR.$parent-selector} .border-#{$style},
|
|
270
|
+
#{VAR.$parent-selector} .hover\:border-#{$style}:hover,
|
|
271
|
+
#{VAR.$parent-selector} .active\:border-#{$style}:active,
|
|
272
|
+
#{VAR.$parent-selector} .focus\:border-#{$style}:focus,
|
|
273
|
+
#{VAR.$parent-selector} .group:hover .group-hover\:border-#{$style} {
|
|
270
274
|
@include border-style($style);
|
|
271
275
|
}
|
|
272
276
|
}
|
|
273
277
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
.border-dark {
|
|
284
|
-
@include border-color(var(--border-dark-color));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.border-primary {
|
|
288
|
-
@include border-color(var(--primary));
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.border-secondary {
|
|
292
|
-
@include border-color(var(--secondary));
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.border-success {
|
|
296
|
-
@include border-color(var(--success));
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.border-danger {
|
|
300
|
-
@include border-color(var(--danger));
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.border-warning {
|
|
304
|
-
@include border-color(var(--warning));
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.border-info {
|
|
308
|
-
@include border-color(var(--info));
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// Common combined border utilities (style + color)
|
|
312
|
-
.border-primary-solid {
|
|
313
|
-
@include border-style(solid);
|
|
314
|
-
@include border-color(var(--primary));
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.border-danger-dashed {
|
|
318
|
-
@include border-style(dashed);
|
|
319
|
-
@include border-color(var(--danger));
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// -----------------------------------------------
|
|
323
|
-
// HOVER, ACTIVE, AND FOCUS STATES
|
|
324
|
-
// -----------------------------------------------
|
|
325
|
-
|
|
326
|
-
// Hover state border classes
|
|
327
|
-
@each $width in VAR.$border-widths {
|
|
328
|
-
.hover\:border-#{$width}:hover {
|
|
329
|
-
@include border($width);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
@each $style in $border-styles {
|
|
334
|
-
.hover\:border-#{$style}:hover {
|
|
335
|
-
@include border-style($style);
|
|
278
|
+
@each $color-name in VAR.$color-names-with-basic {
|
|
279
|
+
#{VAR.$parent-selector} .border-#{$color-name},
|
|
280
|
+
#{VAR.$parent-selector} .hover\:border-#{$color-name}:hover,
|
|
281
|
+
#{VAR.$parent-selector} .active\:border-#{$color-name}:active,
|
|
282
|
+
#{VAR.$parent-selector} .focus\:border-#{$color-name}:focus,
|
|
283
|
+
#{VAR.$parent-selector} .group:hover .group-hover\:border-#{$color-name} {
|
|
284
|
+
@include border-color(var(--#{$color-name}));
|
|
336
285
|
}
|
|
337
286
|
}
|
|
338
287
|
|
|
339
|
-
// Border colors on hover
|
|
340
|
-
.hover\:border-default:hover {
|
|
341
|
-
@include border-color(var(--border));
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.hover\:border-light:hover {
|
|
345
|
-
@include border-color(var(--border-light-color));
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.hover\:border-dark:hover {
|
|
349
|
-
@include border-color(var(--border-dark-color));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.hover\:border-primary:hover {
|
|
353
|
-
@include border-color(var(--primary));
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.hover\:border-secondary:hover {
|
|
357
|
-
@include border-color(var(--secondary));
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
.hover\:border-success:hover {
|
|
361
|
-
@include border-color(var(--success));
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.hover\:border-danger:hover {
|
|
365
|
-
@include border-color(var(--danger));
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
.hover\:border-warning:hover {
|
|
369
|
-
@include border-color(var(--warning));
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.hover\:border-info:hover {
|
|
373
|
-
@include border-color(var(--info));
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// Active state border classes
|
|
377
|
-
@each $width in VAR.$border-widths {
|
|
378
|
-
.active\:border-#{$width}:active {
|
|
379
|
-
@include border($width);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
@each $style in $border-styles {
|
|
384
|
-
.active\:border-#{$style}:active {
|
|
385
|
-
@include border-style($style);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Border colors on active state
|
|
390
|
-
.active\:border-default:active {
|
|
391
|
-
@include border-color(var(--border));
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.active\:border-light:active {
|
|
395
|
-
@include border-color(var(--border-light-color));
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.active\:border-dark:active {
|
|
399
|
-
@include border-color(var(--border-dark-color));
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.active\:border-primary:active {
|
|
403
|
-
@include border-color(var(--primary));
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
.active\:border-secondary:active {
|
|
407
|
-
@include border-color(var(--secondary));
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
.active\:border-success:active {
|
|
411
|
-
@include border-color(var(--success));
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.active\:border-danger:active {
|
|
415
|
-
@include border-color(var(--danger));
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.active\:border-warning:active {
|
|
419
|
-
@include border-color(var(--warning));
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
.active\:border-info:active {
|
|
423
|
-
@include border-color(var(--info));
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
// Focus state border classes
|
|
427
|
-
@each $width in VAR.$border-widths {
|
|
428
|
-
.focus\:border-#{$width}:focus {
|
|
429
|
-
@include border($width);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
@each $style in $border-styles {
|
|
434
|
-
.focus\:border-#{$style}:focus {
|
|
435
|
-
@include border-style($style);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// Border colors on focus
|
|
440
|
-
.focus\:border-default:focus {
|
|
441
|
-
@include border-color(var(--border));
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
.focus\:border-light:focus {
|
|
445
|
-
@include border-color(var(--border-light-color));
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.focus\:border-dark:focus {
|
|
449
|
-
@include border-color(var(--border-dark-color));
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
.focus\:border-primary:focus {
|
|
453
|
-
@include border-color(var(--primary));
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
.focus\:border-secondary:focus {
|
|
457
|
-
@include border-color(var(--secondary));
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.focus\:border-success:focus {
|
|
461
|
-
@include border-color(var(--success));
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
.focus\:border-danger:focus {
|
|
465
|
-
@include border-color(var(--danger));
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
.focus\:border-warning:focus {
|
|
469
|
-
@include border-color(var(--warning));
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.focus\:border-info:focus {
|
|
473
|
-
@include border-color(var(--info));
|
|
474
|
-
}
|
|
475
|
-
|
|
476
288
|
// -----------------------------------------------
|
|
477
289
|
// RESPONSIVE CLASSES
|
|
478
290
|
// -----------------------------------------------
|
|
@@ -481,33 +293,33 @@ $border-styles: (solid, dashed, dotted, double, none);
|
|
|
481
293
|
@media (min-width: #{$width}) {
|
|
482
294
|
// Border width responsive
|
|
483
295
|
@each $val in VAR.$border-widths {
|
|
484
|
-
.border-#{$val}\@#{$breakpoint} {
|
|
296
|
+
#{VAR.$parent-selector} .border-#{$val}\@#{$breakpoint} {
|
|
485
297
|
@include border($val);
|
|
486
298
|
}
|
|
487
299
|
}
|
|
488
300
|
|
|
489
301
|
// Common shortcuts for responsive
|
|
490
|
-
.border\@#{$breakpoint} {
|
|
302
|
+
#{VAR.$parent-selector} .border\@#{$breakpoint} {
|
|
491
303
|
@include border(1);
|
|
492
304
|
}
|
|
493
|
-
.border-0\@#{$breakpoint} {
|
|
305
|
+
#{VAR.$parent-selector} .border-0\@#{$breakpoint} {
|
|
494
306
|
@include border(0);
|
|
495
307
|
}
|
|
496
308
|
|
|
497
309
|
// Border radius responsive
|
|
498
310
|
@each $name, $value in VAR.$border-radii {
|
|
499
|
-
.rounded-#{$name}\@#{$breakpoint} {
|
|
311
|
+
#{VAR.$parent-selector} .rounded-#{$name}\@#{$breakpoint} {
|
|
500
312
|
@include rounded($value);
|
|
501
313
|
}
|
|
502
314
|
}
|
|
503
315
|
|
|
504
|
-
.rounded\@#{$breakpoint} {
|
|
316
|
+
#{VAR.$parent-selector} .rounded\@#{$breakpoint} {
|
|
505
317
|
@include rounded;
|
|
506
318
|
}
|
|
507
|
-
.square\@#{$breakpoint} {
|
|
319
|
+
#{VAR.$parent-selector} .square\@#{$breakpoint} {
|
|
508
320
|
@include rounded(0);
|
|
509
321
|
}
|
|
510
|
-
.pill\@#{$breakpoint} {
|
|
322
|
+
#{VAR.$parent-selector} .pill\@#{$breakpoint} {
|
|
511
323
|
@include pill;
|
|
512
324
|
}
|
|
513
325
|
}
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
@use "sass:map";
|
|
5
5
|
@use "sass:meta";
|
|
6
6
|
@use "sass:list";
|
|
7
|
+
@use "sass:string";
|
|
7
8
|
|
|
8
9
|
@use "../abstracts/config" as *;
|
|
10
|
+
@use "../abstracts/functions" as FN;
|
|
9
11
|
|
|
10
12
|
// Color Validation
|
|
11
13
|
@function is-valid-color($color) {
|
|
@@ -15,39 +17,76 @@
|
|
|
15
17
|
// Scale Generation Function
|
|
16
18
|
@function create-color-scale($color) {
|
|
17
19
|
$scale: ();
|
|
18
|
-
$stops: (
|
|
19
|
-
50: 95%,
|
|
20
|
-
100: 85%,
|
|
21
|
-
200: 75%,
|
|
22
|
-
300: 65%,
|
|
23
|
-
400: 55%,
|
|
24
|
-
500: 50%,
|
|
25
|
-
// Base color
|
|
26
|
-
600: 45%,
|
|
27
|
-
700: 35%,
|
|
28
|
-
800: 25%,
|
|
29
|
-
900: 15%,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
@each $shade, $lightness in $stops {
|
|
33
|
-
$adjusted-color: $color;
|
|
34
|
-
|
|
35
|
-
@if $shade < 500 {
|
|
36
|
-
// Lighter shades: mix with white
|
|
37
|
-
$mix-percentage: math.div($lightness - 50%, 50%) * 100%;
|
|
38
|
-
$adjusted-color: color.mix(white, $color, $mix-percentage);
|
|
39
|
-
} @else if $shade > 500 {
|
|
40
|
-
// Darker shades: mix with black
|
|
41
|
-
$mix-percentage: math.div(50% - $lightness, 50%) * 100%;
|
|
42
|
-
$adjusted-color: color.mix(black, $color, $mix-percentage);
|
|
43
|
-
}
|
|
20
|
+
$stops: (50, 100, 200, 300, 400, 500, 600, 700, 800, 900);
|
|
44
21
|
|
|
22
|
+
@each $shade in $stops {
|
|
23
|
+
$adjusted-color: get-color($color, $shade);
|
|
45
24
|
$scale: map.set($scale, $shade, $adjusted-color);
|
|
46
25
|
}
|
|
47
26
|
|
|
48
27
|
@return $scale;
|
|
49
28
|
}
|
|
50
29
|
|
|
30
|
+
@function get-color($color, $shade: 500) {
|
|
31
|
+
@if FN.is-css-var($color) {
|
|
32
|
+
@if $shade != 500 {
|
|
33
|
+
@warn "CSS variables do not support shade values. ";
|
|
34
|
+
}
|
|
35
|
+
@return FN.get-css-var($color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
$colors-list: (
|
|
39
|
+
"primary": $primary,
|
|
40
|
+
"secondary": $secondary,
|
|
41
|
+
"success": $success,
|
|
42
|
+
"danger": $danger,
|
|
43
|
+
"warning": $warning,
|
|
44
|
+
"info": $info,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
@if meta.type-of($shade) == "string" {
|
|
48
|
+
$shade: FN.to-number($shade);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@if FN.get-type($color) == "color" {
|
|
52
|
+
$color: FN.to-color($color);
|
|
53
|
+
} @else if map.has-key($colors-list, $color) {
|
|
54
|
+
$color: map.get($colors-list, $color);
|
|
55
|
+
} @else if map.has-key($color-primitives, $color) {
|
|
56
|
+
$color: map.get($color-primitives, $color);
|
|
57
|
+
} @else {
|
|
58
|
+
@warn "Unexpected color value: #{$color}";
|
|
59
|
+
@return currentColor;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$x1: 50; // First input value
|
|
63
|
+
$y1: 95; // First output percentage
|
|
64
|
+
$x2: 900; // Second input value
|
|
65
|
+
$y2: 15; // Second output percentage
|
|
66
|
+
// Calculate slope (m) of the line
|
|
67
|
+
$slope: math.div($y2 - $y1, $x2 - $x1);
|
|
68
|
+
|
|
69
|
+
// Calculate y-intercept (b) of the line: y = mx + b
|
|
70
|
+
$y-intercept: $y1 - ($slope * $x1);
|
|
71
|
+
|
|
72
|
+
// Calculate the output percentage using the linear equation: y = mx + b
|
|
73
|
+
$result: ($slope * $shade) + $y-intercept;
|
|
74
|
+
$lightness: math.percentage(math.div($result, 100));
|
|
75
|
+
$adjusted-color: $color;
|
|
76
|
+
|
|
77
|
+
@if $shade < 500 {
|
|
78
|
+
// Lighter shades: mix with white
|
|
79
|
+
$mix-percentage: math.div($lightness - 50%, 50%) * 100%;
|
|
80
|
+
$adjusted-color: color.mix(white, $color, $mix-percentage);
|
|
81
|
+
} @else if $shade > 500 {
|
|
82
|
+
// Darker shades: mix with black
|
|
83
|
+
$mix-percentage: math.div(50% - $lightness, 50%) * 100%;
|
|
84
|
+
$adjusted-color: color.mix(black, $color, $mix-percentage);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@return $adjusted-color;
|
|
88
|
+
}
|
|
89
|
+
|
|
51
90
|
// Luminance calculation for contrast
|
|
52
91
|
@function luminance($color) {
|
|
53
92
|
$red: math.div(color.channel($color, "red"), 255);
|
|
@@ -64,7 +103,16 @@
|
|
|
64
103
|
// Find appropriate text color for a background
|
|
65
104
|
@function find-text-color($background) {
|
|
66
105
|
$luminance: luminance($background);
|
|
67
|
-
|
|
106
|
+
$dark-color: #000;
|
|
107
|
+
@if map.has-key($light-theme, "text-color") {
|
|
108
|
+
$dark-color: map.get($light-theme, "text-color");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
$light-color: #fff;
|
|
112
|
+
@if map.has-key($light-theme, "text-inverted") {
|
|
113
|
+
$light-color: map.get($light-theme, "text-inverted");
|
|
114
|
+
}
|
|
115
|
+
@return if($luminance > 0.55, $dark-color, $light-color);
|
|
68
116
|
}
|
|
69
117
|
|
|
70
118
|
// Adaptive contrast mixin
|
|
@@ -98,12 +146,18 @@ $colors-primitives: ();
|
|
|
98
146
|
}
|
|
99
147
|
|
|
100
148
|
// todo: documentation
|
|
101
|
-
@mixin bg($color) {
|
|
102
|
-
background-color: $color;
|
|
149
|
+
@mixin bg($color, $shade: 500) {
|
|
150
|
+
background-color: get-color($color, $shade);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
@mixin text-color($color-name, $shade: 500) {
|
|
154
|
+
color: get-color($color-name, $shade);
|
|
103
155
|
}
|
|
104
|
-
|
|
105
|
-
|
|
156
|
+
|
|
157
|
+
@mixin text-on-color($color-name, $shade: 500) {
|
|
158
|
+
color: find-text-color(get-color($color-name, $shade));
|
|
106
159
|
}
|
|
160
|
+
|
|
107
161
|
@mixin gradient($direction, $colors...) {
|
|
108
162
|
background-image: linear-gradient($direction, $colors);
|
|
109
163
|
}
|