Skip to content

Commit d41bf1b

Browse files
authored
Merge pull request #11168 from quarto-dev/fix/brand-bootstrap
fix(brand): Fix and improve Bootstrap variable handling
2 parents 5c2d9e4 + 1c7709d commit d41bf1b

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/core/sass/brand.ts

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const brandColorBundle = (
192192

193193
// Create `brand-` prefixed Sass and CSS variables from color.palette
194194
for (const colorKey of Object.keys(brand.data?.color?.palette ?? {})) {
195-
const colorVar = colorKey.replace(/[^a-zA-Z0-9_-]+/, "-");
195+
const colorVar = colorKey.replace(/[^a-zA-Z0-9_-]+/g, "-");
196196
colorVariables.push(
197197
`$brand-${colorVar}: ${brand.getColor(colorKey)} !default;`,
198198
);
@@ -262,26 +262,21 @@ const brandBootstrapBundle = (
262262
bsVariables.push('// quarto-scss-analysis-annotation { "action": "pop" }');
263263

264264
// Bootstrap Colors from color.palette
265-
let bootstrapColorVariables: string[] = [];
266-
if (Number(brandBootstrap?.version ?? 5) === 5) {
267-
// https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps
268-
bootstrapColorVariables = [
269-
"blue",
270-
"indigo",
271-
"purple",
272-
"pink",
273-
"red",
274-
"orange",
275-
"yellow",
276-
"green",
277-
"teal",
278-
"cyan",
279-
"black",
280-
"white",
281-
"gray",
282-
"gray-dark"
283-
]
284-
}
265+
// https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps
266+
const bootstrapColorVariables = [
267+
"black",
268+
"white",
269+
"blue",
270+
"indigo",
271+
"purple",
272+
"pink",
273+
"red",
274+
"orange",
275+
"yellow",
276+
"green",
277+
"teal",
278+
"cyan",
279+
]
285280

286281
const bsColors: string[] = [
287282
"/* Bootstrap color variables from _brand.yml */",

0 commit comments

Comments
 (0)