Skip to content

Commit

Permalink
Merge pull request #11168 from quarto-dev/fix/brand-bootstrap
Browse files Browse the repository at this point in the history
fix(brand): Fix and improve Bootstrap variable handling
  • Loading branch information
cscheid authored Oct 23, 2024
2 parents 5c2d9e4 + 1c7709d commit d41bf1b
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/core/sass/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const brandColorBundle = (

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

// Bootstrap Colors from color.palette
let bootstrapColorVariables: string[] = [];
if (Number(brandBootstrap?.version ?? 5) === 5) {
// https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps
bootstrapColorVariables = [
"blue",
"indigo",
"purple",
"pink",
"red",
"orange",
"yellow",
"green",
"teal",
"cyan",
"black",
"white",
"gray",
"gray-dark"
]
}
// https://getbootstrap.com/docs/5.3/customize/color/#color-sass-maps
const bootstrapColorVariables = [
"black",
"white",
"blue",
"indigo",
"purple",
"pink",
"red",
"orange",
"yellow",
"green",
"teal",
"cyan",
]

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

0 comments on commit d41bf1b

Please sign in to comment.