-
Notifications
You must be signed in to change notification settings - Fork 5
/
temp-1.scss
10182 lines (8679 loc) · 305 KB
/
temp-1.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// quarto-scss-analysis-annotation { "origin": null }
// quarto-scss-analysis-annotation { "origin": null }
@use "sass:color" as quarto-color;
@use "sass:map" as quarto-map;
@use "sass:math" as quarto-math;
// quarto-scss-analysis-annotation { "origin": null }
// quarto-scss-analysis-annotation { "origin": null }
// Bootstrap functions
//
// Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
// Ascending
// Used to evaluate Sass maps like our grid breakpoints.
@mixin _assert-ascending($map, $map-name) {
$prev-key: null;
$prev-num: null;
@each $key, $num in $map {
@if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
// Do nothing
} @else if not comparable($prev-num, $num) {
@warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
} @else if $prev-num >= $num {
@warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
}
$prev-key: $key;
$prev-num: $num;
}
}
// Starts at zero
// Used to ensure the min-width of the lowest breakpoint starts at 0.
@mixin _assert-starts-at-zero($map, $map-name: "$grid-breakpoints") {
@if length($map) > 0 {
$values: map-values($map);
$first-value: nth($values, 1);
@if $first-value != 0 {
@warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
}
}
}
// Colors
@function to-rgb($value) {
@return red($value), green($value), blue($value);
}
// stylelint-disable scss/dollar-variable-pattern
@function rgba-css-var($identifier, $target) {
@if $identifier == "body" and $target == "bg" {
@return rgba(var(--#{$prefix}#{$identifier}-bg-rgb), var(--#{$prefix}#{$target}-opacity));
} @if $identifier == "body" and $target == "text" {
@return rgba(var(--#{$prefix}#{$identifier}-color-rgb), var(--#{$prefix}#{$target}-opacity));
} @else {
@return rgba(var(--#{$prefix}#{$identifier}-rgb), var(--#{$prefix}#{$target}-opacity));
}
}
@function map-loop($map, $func, $args_dot_dot_dot) {
$_map: ();
@each $key, $value in $map {
// allow to pass the $key and $value of the map as an function argument
$_args: ();
@each $arg in $args {
$_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
}
$_map: map-merge($_map, ($key: call(get-function($func), $_args_dot_dot_dot)));
}
@return $_map;
}
// stylelint-enable scss/dollar-variable-pattern
@function varify($list) {
$result: null;
@each $entry in $list {
$result: append($result, var(--#{$prefix}#{$entry}), space);
}
@return $result;
}
// Internal Bootstrap function to turn maps into its negative variant.
// It prefixes the keys with `n` and makes the value negative.
@function negativify-map($map) {
$result: ();
@each $key, $value in $map {
@if $key != 0 {
$result: map-merge($result, ("n" + $key: (-$value)));
}
}
@return $result;
}
// Get multiple keys from a sass map
@function map-get-multiple($map, $values) {
$result: ();
@each $key, $value in $map {
@if (index($values, $key) != null) {
$result: map-merge($result, ($key: $value));
}
}
@return $result;
}
// Merge multiple maps
@function map-merge-multiple($maps_dot_dot_dot) {
$merged-maps: ();
@each $map in $maps {
$merged-maps: map-merge($merged-maps, $map);
}
@return $merged-maps;
}
// Replace `$search` with `$replace` in `$string`
// Used on our SVG icon backgrounds for custom forms.
//
// @author Kitty Giraudel
// @param {String} $string - Initial string
// @param {String} $search - Substring to replace
// @param {String} $replace ('') - New value
// @return {String} - Updated string
@function str-replace($string, $search, $replace: "") {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
// See https://codepen.io/kevinweber/pen/dXWoRw
//
// Requires the use of quotes around data URIs.
@function escape-svg($string) {
@if str-index($string, "data:image/svg+xml") {
@each $char, $encoded in $escaped-characters {
// Do not escape the url brackets
@if str-index($string, "url(") == 1 {
$string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
} @else {
$string: str-replace($string, $char, $encoded);
}
}
}
@return $string;
}
// Color contrast
// See https://github.com/twbs/bootstrap/pull/30168
// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
$_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
@function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
$foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
$max-ratio: 0;
$max-ratio-color: null;
@each $color in $foregrounds {
$contrast-ratio: contrast-ratio($background, $color);
@if $contrast-ratio > $min-contrast-ratio {
@return $color;
} @else if $contrast-ratio > $max-ratio {
$max-ratio: $contrast-ratio;
$max-ratio-color: $color;
}
}
@warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}_dot_dot_dot";
@return $max-ratio-color;
}
@function contrast-ratio($background, $foreground: $color-contrast-light) {
$l1: luminance($background);
$l2: luminance(opaque($background, $foreground));
@return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
}
// Return WCAG2.1 relative luminance
// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
@function luminance($color) {
$rgb: (
"r": red($color),
"g": green($color),
"b": blue($color)
);
@each $name, $value in $rgb {
$value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
$rgb: map-merge($rgb, ($name: $value));
}
@return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
}
// Return opaque color
// opaque(#fff, rgba(0, 0, 0, .5)) => #808080
@function opaque($background, $foreground) {
@return mix(rgba($foreground, 1), $background, opacity($foreground) * 100%);
}
// scss-docs-start color-functions
// Tint a color: mix a color with white
@function tint-color($color, $weight) {
@return mix(white, $color, $weight);
}
// Shade a color: mix a color with black
@function shade-color($color, $weight) {
@return mix(black, $color, $weight);
}
// Shade the color if the weight is positive, else tint it
@function shift-color($color, $weight) {
@return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
}
// scss-docs-end color-functions
// Return valid calc
@function add($value1, $value2, $return-calc: true) {
@if $value1 == null {
@return $value2;
}
@if $value2 == null {
@return $value1;
}
@if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
@return $value1 + $value2;
}
@return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
}
@function subtract($value1, $value2, $return-calc: true) {
@if $value1 == null and $value2 == null {
@return null;
}
@if $value1 == null {
@return -$value2;
}
@if $value2 == null {
@return $value1;
}
@if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
@return $value1 - $value2;
}
@if type-of($value2) != number {
$value2: unquote("(") + $value2 + unquote(")");
}
@return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
}
@function divide($dividend, $divisor, $precision: 10) {
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
$dividend: abs($dividend);
$divisor: abs($divisor);
@if $dividend == 0 {
@return 0;
}
@if $divisor == 0 {
@error "Cannot divide by 0";
}
$remainder: $dividend;
$result: 0;
$factor: 10;
@while ($remainder > 0 and $precision >= 0) {
$quotient: 0;
@while ($remainder >= $divisor) {
$remainder: $remainder - $divisor;
$quotient: $quotient + 1;
}
$result: $result * 10 + $quotient;
$factor: $factor * .1;
$remainder: $remainder * 10;
$precision: $precision - 1;
@if ($precision < 0 and $remainder >= $divisor * 5) {
$result: $result + 1;
}
}
$result: $result * $factor * $sign;
$dividend-unit: unit($dividend);
$divisor-unit: unit($divisor);
$unit-map: (
"px": 1px,
"rem": 1rem,
"em": 1em,
"%": 1%
);
@if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
$result: $result * map-get($unit-map, $dividend-unit);
}
@return $result;
}
/////////////////////////////////////////////////////////////////
// Color contrasting (backported to BS4 from BS5)
// See https://github.com/twbs/bootstrap/pull/30168
/////////////////////////////////////////////////////////////////
// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
$_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
@function color-contrast($background, $foregrounds: null) {
// These variables should be defined in _variables.scss, but we also
// define them here so that 3rd party libs can use if they want
// without polluting the global namespace
$black: #000 !default;
$white: #fff !default;
$color-contrast-dark: $black !default;
$color-contrast-light: $white !default;
$min-contrast-ratio: 3 !default;
@if $foregrounds == null {
$foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
} @else {
$foregrounds: $foregrounds, $color-contrast-light, $color-contrast-dark, $white, $black;
}
$max-ratio: 0;
$max-ratio-color: null;
@each $color in $foregrounds {
$contrast-ratio: contrast-ratio($background, $color);
@if $contrast-ratio > $min-contrast-ratio {
@return $color;
} @else if $contrast-ratio > $max-ratio {
$max-ratio: $contrast-ratio;
$max-ratio-color: $color;
}
}
$color-contrast-warnings: false !default;
@if $color-contrast-warnings {
@warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}_dot_dot_dot";
}
@return $max-ratio-color;
}
@function contrast-ratio($background, $foreground: $color-contrast-light) {
$l1: luminance($background);
$l2: luminance(opaque($background, $foreground));
@return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
}
// Return WCAG2.0 relative luminance
// See https://www.w3.org/WAI/GL/wiki/Relative_luminance
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
@function luminance($color) {
$rgb: (
"r": red($color),
"g": green($color),
"b": blue($color)
);
@each $name, $value in $rgb {
$value: if(divide($value, 255) < .04045, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
$rgb: map-merge($rgb, ($name: $value));
}
@return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
}
// Return opaque color
// opaque(#fff, rgba(0, 0, 0, .5)) => #808080
@function opaque($background, $foreground) {
@return mix(rgba($foreground, 1), $background, opacity($foreground) * 100%);
}
// Added in BS5 as an alternative to the \ operator, which
// throws warnings in Dart Sass
// https://github.com/twbs/bootstrap/pull/34245
@function divide($dividend, $divisor, $precision: 10) {
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
$dividend: abs($dividend);
$divisor: abs($divisor);
@if $dividend == 0 {
@return 0;
}
@if $divisor == 0 {
@error "Cannot divide by 0";
}
$remainder: $dividend;
$result: 0;
$factor: 10;
@while ($remainder > 0 and $precision >= 0) {
$quotient: 0;
@while ($remainder >= $divisor) {
$remainder: $remainder - $divisor;
$quotient: $quotient + 1;
}
$result: $result * 10 + $quotient;
$factor: $factor * .1;
$remainder: $remainder * 10;
$precision: $precision - 1;
@if ($precision < 0 and $remainder >= $divisor * 5) {
$result: $result + 1;
}
}
$result: $result * $factor * $sign;
$dividend-unit: unit($dividend);
$divisor-unit: unit($divisor);
$unit-map: (
"px": 1px,
"rem": 1rem,
"em": 1em,
"%": 1%
);
@if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
$result: $result * map-get($unit-map, $dividend-unit);
}
@return $result;
}
// quarto-scss-analysis-annotation { "origin": null }
@function colorToRGB($color) {
@return "rgb(" + red($color) + ", " + green($color) + ", " + blue($color) +
")";
}
@function colorToRGBA($color) {
@return "rgba(" + red($color) + ", " + green($color) + ", " + blue($color) +
", " + alpha($color) + ")";
}
@function str-replace($string, $search, $replace: "") {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace +
str-replace(
str-slice($string, $index + str-length($search)),
$search,
$replace
);
}
@return $string;
}
// Dims a color (either making it more white or more black)
@function theme-dim($baseColor, $amount) {
@if (tone($baseColor) == "dark") {
@return lighten($baseColor, $amount);
} @else {
@return darken($baseColor, $amount);
}
}
// Provides a contrast color for a given color
// The color is the starting color that will used to form a contrasting color
// The bgColor is the color that will be used to test contrast (e.g. the color
// will be shifted until its contrast against the bgColor is acceptable)
@function theme-contrast($color, $bgColor, $level: "AAA") {
// These will be defined in bootstrap, but creating values here
// That will make this function accessible to callers prior to bootstrap variables
// being set
$black: rgb(0, 0, 0) !default;
$white: rgb(255, 255, 255) !default;
@if tone($bgColor) == "light" {
@return accessibleContrast($color, $black, $bgColor, $level);
} @else {
@return accessibleContrast($color, $white, $bgColor, $level);
}
}
@function accessibleContrast($startColor, $mixColor, $bgColor, $level: "AAA") {
// A: 3:1
// AA: 4.5:1
// AAA: 7:1
$goalContrastRatio: 3;
@if $level == "AA" {
$goalContrastRatio: 4.5;
} @else {
$goalContrastRatio: 7;
}
$percentMix: 100;
$contrastRatio: 0;
$contrastColor: null;
@while ($contrastRatio < $goalContrastRatio and $percentMix > 0) {
$contrastColor: mix(
$startColor,
$mixColor,
percentage(quarto-math.div($percentMix, 100))
);
$contrastRatio: quarto-contrast($contrastColor, $bgColor);
$percentMix: $percentMix - 1;
}
@return $contrastColor;
}
// Fades a color towards the background color
@function theme-fade($baseColor, $backgroundColor, $amount) {
@if (tone($backgroundColor) == "dark") {
@return darken($baseColor, $amount);
} @else {
@return lighten($baseColor, $amount);
}
}
@function theme-highlight($baseColor, $backgroundColor, $amount) {
@if (tone($backgroundColor) == "dark") {
@return lighten($baseColor, $amount);
} @else {
@return darken($baseColor, $amount);
}
}
@function theme-override-value($theme, $varname, $default) {
// These will be defined in bootstrap, but creating values here
// That will make this function accessible to callers prior to bootstrap variables
// being set
$black: rgb(0, 0, 0) !default;
$white: rgb(255, 255, 255) !default;
$gray-500: #adb5bd !default;
$gray-300: #dee2e6 !default;
$blue: #0d6efd !default;
$simplex-border-mix: mix($white, $black, 93.5%) !default;
$theme-overrides: (
cerulean: (
navbar-fg: $white,
valuebox-bg-primary: #2fa4e7,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #67a34d,
valuebox-bg-warning: #aa9208,
valuebox-bg-danger: #c48282,
),
cosmo: (
navbar-bg:
if(
$default == #2780e3,
if(variable-exists(light), $light, $gray-500),
$default
),
link-color: #2761e3,
valuebox-bg-primary: #5397e9,
valuebox-bg-info: #9954bbb3,
valuebox-bg-success: #3aa716,
valuebox-bg-warning: #fa6400,
valuebox-bg-danger: #ff0039b3,
),
cyborg: (
navbar-bg:
if(
$default == #2a9fd6,
if(variable-exists(secondary), $secondary, $black),
$default
),
navbar-hl: $white,
),
darkly: (
navbar-fg: $gray-300,
navbar-hl: $white,
input-border-color: $gray-500,
),
flatly: (
navbar-hl: $white,
valuebox-bg-primary: rgba(39, 128, 227, 0.7),
valuebox-bg-info: rgba(153, 84, 187, 0.7),
valuebox-bg-success: rgba(63, 182, 24, 0.7),
valuebox-bg-warning: rgba(255, 117, 24, 0.7),
valuebox-bg-danger: rgba(255, 0, 57, 0.7),
),
journal: (
navbar-fg: rgba($white, 0.7),
navbar-hl: $white,
valuebox-bg-primary: #f0938f,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #65a244,
valuebox-bg-warning: #ad9310,
valuebox-bg-danger: #c77f7f,
),
litera: (
navbar-bg: if($default == #4582ec, $white, $default),
),
lumen: (
navbar-fg: rgba($white, 0.7),
navbar-hl: $white,
valuebox-bg-primary: #67abcc,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #5ea343,
valuebox-bg-warning: #a79011,
valuebox-bg-danger: #ca8181,
),
lux: (),
materia: (
navbar-fg: rgba($white, 0.7),
navbar-hl: $white,
),
minty: (
navbar-fg: $white,
),
morph: (
navbar-bg:
if(
$default == #378dfc,
if(variable-exists(body-bg), $body-bg, $black),
$default
),
navbar-fg: rgba($black, 0.5),
),
paper: (
valuebox-bg-primary: #4396ea,
valuebox-bg-info: #c277cf,
valuebox-bg-success: #59a343,
valuebox-bg-warning: #d68100,
valuebox-bg-danger: #f46762,
),
pulse: (
navbar-fg: rgba($white, 0.7),
navbar-hl: $white,
),
quartz: (
navbar-fg: rgba($white, 0.8),
navbar-hl: $white,
),
sandstone: (
navbar-bg:
if(
$default == #325d88,
if(variable-exists(dark), $dark, $black),
$default
),
navbar-fg: rgba($white, 0.7),
navbar-hl: $white,
valuebox-bg-primary: #7b98ad,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #60a545,
valuebox-bg-warning: #af8e08,
valuebox-bg-danger: #ca8181,
),
simplex: (
navbar-bg: if($default == #d9230f, $white, $default),
navbar-fg: rgba($black, 0.6),
navbar-hl: $black,
nav-tabs-link-active-border-color: $simplex-border-mix $simplex-border-mix
transparent,
valuebox-bg-primary: #db766b,
valuebox-bg-info: #359ed0,
valuebox-bg-success: #59a343,
valuebox-bg-warning: #a59212,
valuebox-bg-danger: #c48282,
),
sketchy: (
navbar-fg: $white,
),
slate: (),
solar: (
navbar-bg:
if(
$default == #b58900,
if(variable-exists(dark), $dark, $black),
$default
),
navbar-hl: $white,
),
spacelab: (
navbar-bg:
if(
$default == #446e9b,
if(variable-exists(light), $light, #bbb),
$default
),
navbar-hl: if(variable-exists(link-color), $link-color, $blue),
valuebox-bg-primary: #7e97ae,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #62a540,
valuebox-bg-warning: #a59212,
valuebox-bg-danger: #c97e7e,
),
superhero: (
navbar-bg:
if(
$default == #df6919,
if(variable-exists(dark), $dark, $black),
$default
),
navbar-hl: $white,
),
united: (
navbar-fg: rgba($white, 0.8),
navbar-hl: $white,
valuebox-bg-primary: #5c9bbc,
valuebox-bg-info: #3d9dd1,
valuebox-bg-success: #60a545,
valuebox-bg-warning: #9a9623,
valuebox-bg-danger: #c48282,
),
vapor: (
navbar-fg: rgba($white, 0.8),
navbar-hl: $white,
),
yeti: (),
zephyr: (),
);
$val: null;
@if ($theme != null) {
$theme-vals: quarto-map.get($theme-overrides, $theme);
@if ($theme-vals != null) {
$val: quarto-map.get($theme-vals, $varname);
}
}
@if ($val != null) {
@return $val;
} @else {
@return $default;
}
}
@function theme-navbar-bg($theme, $primary) {
$white: rgb(255, 255, 255) !default;
// These will be defined in bootstrap, but creating values here
// That will make this function accessible to callers prior to bootstrap variables
// being set
$theme-bgs: (
litera: $white,
cyborg: if(variable-exists(body-bg), $body-bg, #000),
);
$bg: quarto-map.get($theme-bgs, $theme);
@if ($bg != null) {
@return $bg;
} @else {
@return if(variable-exists(primary), $primary, #fff);
}
}
@function theme-navbar-fg($theme, $primary) {
$white: rgb(255, 255, 255) !default;
// These will be defined in bootstrap, but creating values here
// That will make this function accessible to callers prior to bootstrap variables
// being set
$theme-fgs: (
cerulean: $white,
);
$bg: quarto-map.get($theme-bgs, $theme);
@if ($bg != null) {
@return $bg;
} @else {
@return if(variable-exists(primary), $primary, #fff);
}
}
@function repeat-chars($chars, $n) {
$final: "";
@for $i from 1 through $n {
$final: $final + $chars;
}
@return $final;
}
@function _linear-channel-value($channel-value) {
$normalized-channel-value: quarto-math.div($channel-value, 255);
@if $normalized-channel-value < 0.03928 {
@return quarto-math.div($normalized-channel-value, 12.92);
}
@return quarto-math.pow(
quarto-math.div(($normalized-channel-value + 0.055), 1.055),
2.4
);
}
// Calculate the luminance for a color.
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
@function luminance($color) {
$red: _linear-channel-value(quarto-color.red($color));
$green: _linear-channel-value(quarto-color.green($color));
$blue: _linear-channel-value(quarto-color.blue($color));
@return 0.2126 * $red + 0.7152 * $green + 0.0722 * $blue;
}
// Calculate the contrast ratio between two colors.
// See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
@function quarto-contrast($back, $front) {
$backLum: luminance($back) + 0.05;
$foreLum: luminance($front) + 0.05;
@return quarto-math.div(
quarto-math.max($backLum, $foreLum),
quarto-math.min($backLum, $foreLum)
);
}
// Determine whether the color is 'light' or 'dark'.
@function tone($color) {
@if $color == "dark" or $color == "light" {
@return $color;
}
$minimumContrast: 3.1;
$lightContrast: quarto-contrast($color, white);
$darkContrast: quarto-contrast($color, rgba(black, 0.87));
@if ($lightContrast < $minimumContrast) and ($darkContrast > $lightContrast) {
@return "light";
} @else {
@return "dark";
}
}
// Determine whether to use dark or light text on top of given color to meet accessibility standards for contrast.
// Returns 'dark' if the given color is light and 'light' if the given color is dark.
@function contrast-tone($color) {
@return if(tone($color) == "dark", "light", "dark");
}
// quarto-scss-analysis-annotation { "origin": null }
// quarto-scss-analysis-annotation { "origin": null }
// $navbar-bg: #FFF !default;
// Heading font size customization
$h1-font-size: 2rem !default;
$h2-font-size: 1.65rem !default;
$h3-font-size: 1.45rem !default;
$h4-font-size: 1.25rem !default;
$h5-font-size: 1.1rem !default;
$kbd-padding-y: 0.4rem !default;
$kbd-padding-x: 0.4rem !default;
// Speed up the default transition for the navbar
$transition-collapse: height 0.2s ease !default;
// Adjust the base font size up a little
$font-size-root: 17px !default;
// Disable smooth scrolling
$enable-smooth-scroll: false !default;
// quarto-scss-analysis-annotation { "origin": "cosmo (builtin theme)" }
$theme: "cosmo" !default;
//
// Color system
//
$white: #fff !default;
$gray-100: #f8f9fa !default;
$gray-200: #e9ecef !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #868e96 !default;
$gray-700: #495057 !default;
$gray-800: #373a3c !default;
$gray-900: #212529 !default;
$black: #000 !default;
$blue: #2780e3 !default;
$indigo: #6610f2 !default;
$purple: #613d7c !default;
$pink: #e83e8c !default;
$red: #ff0039 !default;
$orange: #f0ad4e !default;
$yellow: #ff7518 !default;
$green: #3fb618 !default;
$teal: #20c997 !default;
$cyan: #9954bb !default;
$primary: $blue !default;
$secondary: $gray-800 !default;
$success: $green !default;
$info: $cyan !default;
$warning: $yellow !default;
$danger: $red !default;
$light: $gray-100 !default;
$dark: $gray-800 !default;
$min-contrast-ratio: 2.6 !default;
// Options
$enable-rounded: false !default;
// Body
$body-color: $gray-800 !default;
// Fonts
// stylelint-disable-next-line value-keyword-case
$font-family-sans-serif: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !default;
$headings-font-weight: 400 !default;
// Navbar
$navbar-dark-hover-color: rgba($white, 1) !default;
$navbar-light-hover-color: rgba($black, .9) !default;
// Alerts
$alert-border-width: 0 !default;
// Progress bars
$progress-height: .5rem !default;
/*-- scss: functions --*/
@function bannerColor() {
@if $title-banner-color {
@return $title-banner-color;
} @else {
@if variable-exists(navbar-fg) {
@return $navbar-fg;
} @else {
@return $body-bg;
}
}
}
@function bannerDim() {
@return theme-fade(bannerColor(), bannerBg(), 20%);
}
@function bannerBg() {
@if $title-banner-bg {
@return $title-banner-bg;
} @else {
// figure out default background, navbar of body color
@if variable-exists(navbar-bg) {
@return $navbar-bg;
} @else {
@return $body-color;
}