Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SASS deprecated lighten, darken and color methods #40865

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
"rollup": "^4.21.2",
"rollup-plugin-istanbul": "^5.0.0",
"rtlcss": "^4.3.0",
"sass": "^1.77.8",
"sass": "^1.79.3",
"sass-true": "^8.0.0",
"shelljs": "^0.8.5",
"stylelint": "^16.8.1",
Expand Down Expand Up @@ -184,4 +184,4 @@
"@popperjs/core": "^2.11.8"
}
}
}
}
10 changes: 6 additions & 4 deletions scss/_functions.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
// Bootstrap functions
//
// Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
Expand Down Expand Up @@ -34,7 +35,7 @@

// Colors
@function to-rgb($value) {
@return red($value), green($value), blue($value);
@return color.channel($value, "red", $space: rgb), color.channel($value, "green", $space: rgb), color.channel($value, "blue", $space: rgb);
}

// stylelint-disable scss/dollar-variable-pattern
Expand Down Expand Up @@ -181,10 +182,11 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
// See https://www.w3.org/TR/WCAG/#dfn-relative-luminance
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
@function luminance($color) {
// stylelint-disable scss/at-function-named-arguments
$rgb: (
"r": red($color),
"g": green($color),
"b": blue($color)
"r": color.channel($color, "red", $space: rgb),
"g": color.channel($color, "green", $space: rgb),
"b": color.channel($color, "blue", $space: rgb)
);

@each $name, $value in $rgb {
Expand Down
6 changes: 4 additions & 2 deletions site/assets/scss/_content.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:color";
//
// Bootstrap docs content theming
//
Expand Down Expand Up @@ -148,12 +149,13 @@
--bs-dropdown-link-active-bg: #{$blue-700};
}

// stylelint-disable scss/at-function-named-arguments
.btn-secondary {
--bs-btn-bg: #{mix($gray-600, $blue-400, .5)};
--bs-btn-border-color: #{rgba($white, .25)};
--bs-btn-hover-bg: #{darken(mix($gray-600, $blue-400, .5), 5%)};
--bs-btn-hover-bg: #{color.adjust(mix($gray-600, $blue-400, .5), $lightness: -5%)};
--bs-btn-hover-border-color: #{rgba($white, .25)};
--bs-btn-active-bg: #{darken(mix($gray-600, $blue-400, .5), 10%)};
--bs-btn-active-bg: #{color.adjust(mix($gray-600, $blue-400, .5), $lightness: -10%)};
--bs-btn-active-border-color: #{rgba($white, .5)};
--bs-btn-focus-border-color: #{rgba($white, .5)};
--bs-btn-focus-box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .2);
Expand Down
6 changes: 4 additions & 2 deletions site/assets/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@use "sass:color";
// Local docs variables
$bd-purple: #4c0bce;
$bd-violet: lighten(saturate($bd-purple, 5%), 15%); // stylelint-disable-line function-disallowed-list
$bd-purple-light: lighten(saturate($bd-purple, 5%), 45%); // stylelint-disable-line function-disallowed-list
// stylelint-disable scss/at-function-named-arguments
$bd-violet: color.adjust(saturate($bd-purple, 5%), $lightness: 15%); // stylelint-disable-line function-disallowed-list
$bd-purple-light: color.adjust(saturate($bd-purple, 5%), $lightness: 45%); // stylelint-disable-line function-disallowed-list
$bd-accent: #ffe484;

$bd-gutter-x: 3rem;
Expand Down