blob: 0d89cc4c1691b0a2ea02ce9f53f98cb7eff115ac [file] [log] [blame]
jason westoverd36ac8a2025-11-03 20:58:59 -06001@use "sass:math";
2
Yoshie Muranaka1f4eaa12020-08-10 11:17:12 -07003// This function is usually used to get a lighter
4// theme variant color to use as a background color
5@function theme-color-light($variant) {
jason westoverd36ac8a2025-11-03 20:58:59 -06006 @return shift-color(map-get($theme-colors, $variant), -90.4%);
Sukanya Pandeyfde429e2020-09-14 20:48:39 +05307}
8
9@function theme-color-dark($variant) {
jason westoverd36ac8a2025-11-03 20:58:59 -060010 @return shift-color(map-get($theme-colors, $variant), 16%);
11}
12
13// Bootstrap 5 no longer provides theme-color(); define a compatible helper
14@function theme-color($variant) {
15 @return map-get($theme-colors, $variant);
16}
17
18// Bootstrap 4 compatibility: theme-color-level() function
19// Positive levels darken (mix with black), negative levels lighten (mix with white)
20// Each level is 8% change, matching Bootstrap 4 behavior
21@function theme-color-level($variant, $level: 0) {
22 $color: map-get($theme-colors, $variant);
23 $weight: $level * 8%;
24
25 @if $level > 0 {
26 @return shade-color($color, $weight);
27 } @else if $level < 0 {
28 @return tint-color($color, math.abs($weight));
29 } @else {
30 @return $color;
31 }
Yoshie Muranaka1f4eaa12020-08-10 11:17:12 -070032}