@@ -240,7 +240,8 @@ const brandColorBundle = (
240240const brandBootstrapBundle = (
241241 brand : Brand ,
242242 key : string
243- ) : SassBundleLayers | void => {
243+ ) : SassBundleLayers => {
244+ // Bootstrap Variables from brand.defaults.bootstrap
244245 const brandBootstrap = ( brand ?. data ?. defaults ?. bootstrap as unknown as Record <
245246 string ,
246247 Record < string , string | boolean | number | null >
@@ -258,13 +259,54 @@ const brandBootstrapBundle = (
258259 `$${ bsVar } : ${ brandBootstrap [ bsVar ] } !default;` ,
259260 ) ;
260261 }
261- // const colorEntries = Object.keys(brand.color);
262262 bsVariables . push ( '// quarto-scss-analysis-annotation { "action": "pop" }' ) ;
263+
264+ // 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+ }
285+
286+ const bsColors : string [ ] = [
287+ "/* Bootstrap color variables from _brand.yml */" ,
288+ '// quarto-scss-analysis-annotation { "action": "push", "origin": "_brand.yml color.palette" }' ,
289+ ] ;
290+
291+ if ( bootstrapColorVariables . length > 0 ) {
292+ for ( const colorKey of Object . keys ( brand . data ?. color ?. palette ?? { } ) ) {
293+ if ( ! bootstrapColorVariables . includes ( colorKey ) ) {
294+ continue ;
295+ }
296+
297+ bsColors . push (
298+ `$${ colorKey } : ${ brand . getColor ( colorKey ) } !default;` ,
299+ ) ;
300+ }
301+ }
302+
303+ bsColors . push ( '// quarto-scss-analysis-annotation { "action": "pop" }' ) ;
304+
263305 const bsBundle : SassBundleLayers = {
264306 key,
265307 // dependency: "bootstrap",
266308 quarto : {
267- defaults : bsVariables . join ( "\n" ) ,
309+ defaults : bsColors . join ( "\n" ) + "\n" + bsVariables . join ( "\n" ) ,
268310 uses : "" ,
269311 functions : "" ,
270312 mixins : "" ,
0 commit comments