mirror of https://github.com/twbs/bootstrap.git
Replace `green()`, `red()`, and `blue()` by `color.channel`
This commit is contained in:
parent
69d644aa89
commit
32c46ba3dc
|
@ -1,3 +1,6 @@
|
||||||
|
@use "sass:color";
|
||||||
|
@use "sass:math";
|
||||||
|
|
||||||
// Bootstrap functions
|
// Bootstrap functions
|
||||||
//
|
//
|
||||||
// Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
|
// Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
|
||||||
|
@ -34,7 +37,7 @@
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
@function to-rgb($value) {
|
@function to-rgb($value) {
|
||||||
@return red($value), green($value), blue($value);
|
@return math.round(color.channel($value, "red", $space: rgb)), math.round(color.channel($value, "green", $space: rgb)), math.round(color.channel($value, "blue", $space: rgb));
|
||||||
}
|
}
|
||||||
|
|
||||||
// stylelint-disable scss/dollar-variable-pattern
|
// stylelint-disable scss/dollar-variable-pattern
|
||||||
|
@ -182,9 +185,9 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
|
||||||
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
|
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
|
||||||
@function luminance($color) {
|
@function luminance($color) {
|
||||||
$rgb: (
|
$rgb: (
|
||||||
"r": red($color),
|
"r": math.round(color.channel($color, "red", $space: rgb)), // stylelint-disable-line scss/at-function-named-arguments
|
||||||
"g": green($color),
|
"g": math.round(color.channel($color, "green", $space: rgb)), // stylelint-disable-line scss/at-function-named-arguments
|
||||||
"b": blue($color)
|
"b": math.round(color.channel($color, "blue", $space: rgb)) // stylelint-disable-line scss/at-function-named-arguments
|
||||||
);
|
);
|
||||||
|
|
||||||
@each $name, $value in $rgb {
|
@each $name, $value in $rgb {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@include color-mode(dark, true) {
|
@include color-mode(dark, true) {
|
||||||
--custom-color: #{mix($indigo, $blue, 50%)};
|
--custom-color: #{$indigo};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@include expect() {
|
@include expect() {
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
background-color: var(--bs-primary-bg-subtle);
|
background-color: var(--bs-primary-bg-subtle);
|
||||||
}
|
}
|
||||||
[data-bs-theme=dark] {
|
[data-bs-theme=dark] {
|
||||||
--custom-color: #3a3ff8;
|
--custom-color: #6610f2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@include color-mode(dark, true) {
|
@include color-mode(dark, true) {
|
||||||
--custom-color: #{mix($indigo, $blue, 50%)};
|
--custom-color: #{$indigo}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@include expect() {
|
@include expect() {
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root {
|
:root {
|
||||||
--custom-color: #3a3ff8;
|
--custom-color: #6610f2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ const { runSass } = require('sass-true')
|
||||||
|
|
||||||
module.exports = (filename, { describe, it }) => {
|
module.exports = (filename, { describe, it }) => {
|
||||||
const data = fs.readFileSync(filename, 'utf8')
|
const data = fs.readFileSync(filename, 'utf8')
|
||||||
const TRUE_SETUP = '$true-terminal-output: false; @import "true";'
|
const TRUE_SETUP = '$true-terminal-output: false; @use "true" as *;'
|
||||||
const sassString = TRUE_SETUP + data
|
const sassString = TRUE_SETUP + data
|
||||||
|
|
||||||
runSass(
|
runSass(
|
||||||
|
|
Loading…
Reference in New Issue