Skip to content

Commit

Permalink
Merge pull request #11261 from quarto-dev/bugfix/11255
Browse files Browse the repository at this point in the history
SCSS, brand: forward background color from monospace to -block and -inline
  • Loading branch information
cscheid authored Oct 31, 2024
2 parents fdf3a5d + ac34337 commit efe1328
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
26 changes: 19 additions & 7 deletions src/core/sass/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const brandColorBundle = (
);
colorCssVariables.push(
` --brand-${colorVar}: ${brand.getColor(colorKey)};`,
)
);
}

// Map theme colors directly to Sass variables
Expand All @@ -222,7 +222,10 @@ const brandColorBundle = (
}
// const colorEntries = Object.keys(brand.color);
colorVariables.push('// quarto-scss-analysis-annotation { "action": "pop" }');
colorCssVariables.push("}", '// quarto-scss-analysis-annotation { "action": "pop" }');
colorCssVariables.push(
"}",
'// quarto-scss-analysis-annotation { "action": "pop" }',
);
const colorBundle: SassBundleLayers = {
key,
// dependency: "bootstrap",
Expand All @@ -239,13 +242,13 @@ const brandColorBundle = (

const brandBootstrapBundle = (
brand: Brand,
key: string
key: string,
): SassBundleLayers => {
// Bootstrap Variables from brand.defaults.bootstrap
const brandBootstrap = (brand?.data?.defaults?.bootstrap as unknown as Record<
const brandBootstrap = brand?.data?.defaults?.bootstrap as unknown as Record<
string,
Record<string, string | boolean | number | null>
>);
>;

const bsVariables: string[] = [
"/* Bootstrap variables from _brand.yml */",
Expand Down Expand Up @@ -276,7 +279,7 @@ const brandBootstrapBundle = (
"green",
"teal",
"cyan",
]
];

const bsColors: string[] = [
"/* Bootstrap color variables from _brand.yml */",
Expand Down Expand Up @@ -459,6 +462,10 @@ const brandTypographyBundle = (
// revealjs
["size", "code-block-font-size"],
["color", "code-block-color"],

// monospace forwards to both block and inline
["background-color", "code-bg"],
["background-color", "code-block-bg"],
],
"monospace-block": [
// bootstrap + revealjs
Expand Down Expand Up @@ -566,7 +573,12 @@ export async function brandBootstrapSassBundleLayers(
nameMap: Record<string, string> = {},
): Promise<SassBundleLayers[]> {
const brand = await project.resolveBrand(fileName);
const sassBundles = await brandSassBundleLayers(fileName, project, key, nameMap);
const sassBundles = await brandSassBundleLayers(
fileName,
project,
key,
nameMap,
);

if (brand?.data?.defaults?.bootstrap) {
const bsBundle = brandBootstrapBundle(brand, key);
Expand Down
2 changes: 1 addition & 1 deletion tools/sass-variable-explainer/parse-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import { parse } from 'https://cdn.skypack.dev/scss-parser/';
// import * as prettier from "https://esm.sh/[email protected]"; // skypack crashes with prettier
import { makeParserModule } from "./parse.ts";

export const getSassAst = makeParserModule(parse, (s: string) => s).getSassAst;
export const getSassAst = makeParserModule(parse).getSassAst;

0 comments on commit efe1328

Please sign in to comment.