Skip to content

Commit f146dff

Browse files
committed
refactor: replace mix() with color.mix()
1 parent 5ea8f8e commit f146dff

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

scss/_variables-dark.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ $info-bg-subtle-dark: $info-bg-subtle !default;
8888
$warning-bg-subtle-dark: $warning-bg-subtle !default;
8989
$danger-bg-subtle-dark: $danger-bg-subtle !default;
9090
$light-bg-subtle-dark: $gray-800-dark !default;
91-
$dark-bg-subtle-dark: mix($gray-800-dark, $black) !default;
91+
$dark-bg-subtle-dark: color.mix($gray-800-dark, $black) !default;
9292
// scss-docs-end theme-bg-subtle-dark-variables
9393

9494
// scss-docs-start theme-border-subtle-dark-variables
@@ -107,7 +107,7 @@ $body-bg-dark: $gray-900-dark !default;
107107
$body-secondary-color-dark: rgba($white, .6) !default;
108108
$body-secondary-bg-dark: $gray-800-dark !default;
109109
$body-tertiary-color-dark: rgba($white, .38) !default;
110-
$body-tertiary-bg-dark: mix($gray-800-dark, #212631, 50%) !default;
110+
$body-tertiary-bg-dark: color.mix($gray-800-dark, #212631, 50%) !default;
111111
$body-emphasis-color-dark: $white !default;
112112
$border-color-dark: $gray-800-dark !default;
113113
$border-color-translucent-dark: rgba($white, .1) !default;

scss/_variables.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:color";
12
@use "functions/assert" as *;
23
@use "functions/color" as *;
34
@use "functions/math" as *;
@@ -354,7 +355,7 @@ $success-bg-subtle: #cbedd6 !default;
354355
$info-bg-subtle: #c0e6ff !default;
355356
$warning-bg-subtle: #feecc5 !default;
356357
$danger-bg-subtle: #f9d4d4 !default;
357-
$light-bg-subtle: mix($gray-100, $white) !default;
358+
$light-bg-subtle: color.mix($gray-100, $white) !default;
358359
$dark-bg-subtle: $gray-400 !default;
359360
// scss-docs-end theme-bg-subtle-variables
360361

@@ -872,7 +873,7 @@ $btn-active-box-shadow: inset 0 3px 5px rgba($black, .125) !default;
872873
$btn-link-color: var(--#{$prefix}link-color) !default;
873874
$btn-link-hover-color: var(--#{$prefix}link-hover-color) !default;
874875
$btn-link-disabled-color: $gray-600 !default;
875-
// $btn-link-focus-shadow-rgb: to-rgb(mix(color-contrast($link-color), $link-color, 15%)) !default; TODO: ????
876+
// $btn-link-focus-shadow-rgb: to-rgb(color.mix(color-contrast($link-color), $link-color, 15%)) !default; TODO: ????
876877

877878
// Allows for customizing button radius independently from global border radius
878879
$btn-border-radius: var(--#{$prefix}border-radius) !default;

scss/functions/_color-contrast.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@
5454
// Return opaque color
5555
// opaque(#fff, rgba(0, 0, 0, .5)) => #808080
5656
@function opaque($background, $foreground) {
57-
@return mix(rgba($foreground, 1), $background, opacity($foreground) * 100%);
57+
@return color.mix(rgba($foreground, 1), $background, opacity($foreground) * 100%);
5858
}

scss/functions/_color.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// scss-docs-start color-functions
44
// Tint a color: mix a color with white
55
@function tint-color($color, $weight) {
6-
@return mix(white, $color, $weight);
6+
@return color.mix(white, $color, $weight);
77
}
88

99
// Shade a color: mix a color with black
1010
@function shade-color($color, $weight) {
11-
@return mix(black, $color, $weight);
11+
@return color.mix(black, $color, $weight);
1212
}
1313

1414
// Shade the color if the weight is positive, else tint it

scss/mixins/_buttons.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "sass:color";
12
@use "../variables" as *;
23
@use "../functions/color" as *;
34
@use "../functions/color-contrast" as *;
@@ -29,7 +30,7 @@
2930
--#{$prefix}btn-hover-color: #{$hover-color};
3031
--#{$prefix}btn-hover-bg: #{$hover-background};
3132
--#{$prefix}btn-hover-border-color: #{$hover-border};
32-
--#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix($color, $border, 15%))};
33+
--#{$prefix}btn-focus-shadow-rgb: #{to-rgb(color.mix($color, $border, 15%))};
3334
--#{$prefix}btn-active-color: #{$active-color};
3435
--#{$prefix}btn-active-bg: #{$active-background};
3536
--#{$prefix}btn-active-border-color: #{$active-border};

scss/mixins/_table-variants.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
@use "sass:color";
12
@use "../variables" as *;
23
@use "../functions/color-contrast" as *;
34

45
// scss-docs-start table-variant
56
@mixin table-variant($state, $background) {
67
.table-#{$state} {
78
$color: color-contrast(opaque($body-bg, $background));
8-
$hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
9-
$striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
10-
$active-bg: mix($color, $background, percentage($table-active-bg-factor));
11-
$table-border-color: mix($color, $background, percentage($table-border-factor));
9+
$hover-bg: color.mix($color, $background, percentage($table-hover-bg-factor));
10+
$striped-bg: color.mix($color, $background, percentage($table-striped-bg-factor));
11+
$active-bg: color.mix($color, $background, percentage($table-active-bg-factor));
12+
$table-border-color: color.mix($color, $background, percentage($table-border-factor));
1213

1314
--#{$prefix}table-color: #{$color};
1415
--#{$prefix}table-bg: #{$background};

0 commit comments

Comments
 (0)