Skip to content

theme compilation fails if brand.color.primary is specified for light or dark but not both #13369

@gordonwoodhull

Description

@gordonwoodhull

Often the light defaults are okay.

But this example

---
title: primary only
brand:
  color:
    background:
      light: '#f3f3f8'
      dark: '#0f0412'
    foreground:
      light: '#113322'
      dark: '#f8f8f8'
    primary:
      dark: '#20bbff'
---

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

fails with

WARN: "primary" is not a valid CSS color name.
This might cause SCSS compilation to fail, or the color to have no effect.

...

ERROR: Theme file compilation failed:

Error: $color: primary is not a color.
    ╷
987 │   $red: _linear-channel-value(quarto-color.red($color));
    │                               ^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
  .quarto/quarto-session-temp411a0a3cfe5036fd/d349f09b685d0502.scss 987:31   luminance()
  .quarto/quarto-session-temp411a0a3cfe5036fd/d349f09b685d0502.scss 997:13   quarto-contrast()
  .quarto/quarto-session-temp411a0a3cfe5036fd/d349f09b685d0502.scss 1014:19  tone()
  .quarto/quarto-session-temp411a0a3cfe5036fd/d349f09b685d0502.scss 671:7    theme-contrast()

It doesn't matter whether light or dark is omitted.

Omitting light or dark of foreground or background causes Quarto to emit the warning but not the error.

IMO the warning already indicates something has gone wrong, so this seems to be an issue with any named colors we use in our SCSS.

There are no warnings or failures when specifying only light or dark typography colors.

Metadata

Metadata

Labels

brand`_brand.yml`bugSomething isn't workingdark-modedark mode and switching between light and dark modes

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions