Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions src/core/brand/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,42 +675,44 @@ export function splitUnifiedBrand(
? typography.headings
: {
...typography.headings,
color: headingsColor && headingsColor[mode],
...(headingsColor?.[mode] && { color: headingsColor[mode] }),
},
monospace:
!typography.monospace || typeof typography.monospace === "string"
? typography.monospace
: {
...typography.monospace,
color: monospaceColor && monospaceColor[mode],
"background-color": monospaceBackgroundColor &&
monospaceBackgroundColor[mode],
...(monospaceColor?.[mode] && { color: monospaceColor[mode] }),
...(monospaceBackgroundColor?.[mode] &&
{ "background-color": monospaceBackgroundColor[mode] }),
},
"monospace-inline": !typography["monospace-inline"] ||
typeof typography["monospace-inline"] === "string"
? typography["monospace-inline"]
: {
...typography["monospace-inline"],
color: monospaceInlineColor && monospaceInlineColor[mode],
"background-color": monospaceInlineBackgroundColor &&
monospaceInlineBackgroundColor[mode],
...(monospaceInlineColor?.[mode] &&
{ color: monospaceInlineColor[mode] }),
...(monospaceInlineBackgroundColor?.[mode] &&
{ "background-color": monospaceInlineBackgroundColor[mode] }),
},
"monospace-block": !typography["monospace-block"] ||
typeof typography["monospace-block"] === "string"
? typography["monospace-block"]
: {
...typography["monospace-block"],
color: monospaceBlockColor && monospaceBlockColor[mode],
"background-color": monospaceBlockBackgroundColor &&
monospaceBlockBackgroundColor[mode],
...(monospaceBlockColor?.[mode] &&
{ color: monospaceBlockColor[mode] }),
...(monospaceBlockBackgroundColor?.[mode] &&
{ "background-color": monospaceBlockBackgroundColor[mode] }),
},
link: !typography.link || typeof typography.link === "string"
? typography.link
: {
...typography.link,
color: linkColor && linkColor[mode],
"background-color": linkBackgroundColor &&
linkBackgroundColor[mode],
...(linkColor?.[mode] && { color: linkColor[mode] }),
...(linkBackgroundColor?.[mode] &&
{ "background-color": linkBackgroundColor[mode] }),
},
};
const logos = unifiedBrand.logo && splitLogo(unifiedBrand.logo);
Expand All @@ -733,10 +735,12 @@ export function splitUnifiedBrand(
if (!unifiedBrand.color[colorName]) {
continue;
}
({
light: lightBrand.color![colorName],
dark: darkBrand.color![colorName],
} = splitColorLightDark(unifiedBrand.color![colorName]));
const { light, dark } = splitColorLightDark(
unifiedBrand.color[colorName],
);

if (light !== undefined) lightBrand.color![colorName] = light;
if (dark !== undefined) darkBrand.color![colorName] = dark;
}
}
return {
Expand Down
2 changes: 1 addition & 1 deletion src/core/sass/brand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const fileFontImportString = (brand: Brand, description: BrandFontFile) => {
}
parts.push(`@font-face {
font-family: '${description.family}';
src: url('${join(pathPrefix, path).replace(/\\/g, '/')}');
src: url('${join(pathPrefix, path).replace(/\\/g, "/")}');
font-weight: ${weight || "normal"};
font-style: ${style || "normal"};
}\n`);
Expand Down
21 changes: 21 additions & 0 deletions tests/docs/smoke-all/brand/color/background-light-only.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: primary only
brand:
color:
background:
light: '#f3f3f8'
foreground:
light: '#0f0412'
dark: '#f8f8f8'
_quarto:
tests:
html:
printsMessage:
level: WARN
regex: '"[a-z]*" is not a valid CSS color name'
negate: true
---

---

Here is some text [with a link](https://example.com).
21 changes: 21 additions & 0 deletions tests/docs/smoke-all/brand/color/foreground-dark-only.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: primary only
brand:
color:
background:
light: '#f3f3f8'
dark: '#0f0412'
foreground:
dark: '#f8f8f8'
_quarto:
tests:
html:
printsMessage:
level: WARN
regex: '"[a-z]*" is not a valid CSS color name'
negate: true
---

---

Here is some text [with a link](https://example.com).
22 changes: 22 additions & 0 deletions tests/docs/smoke-all/brand/color/primary-dark-only.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: primary only
brand:
color:
background:
light: '#f3f3f8'
dark: '#0f0412'
foreground:
light: '#113322'
dark: '#f8f8f8'
primary:
dark: '#20bbff'
_quarto:
tests:
html:
printsMessage:
level: WARN
regex: '"[a-z]*" is not a valid CSS color name'
negate: true
---

Here is some text [with a link](https://example.com).
Loading