Skip to content

Light/dark toggle shown without dark stylesheet when the dark brand file holds only comments #15131

Closed

Description

@cderv

Since #15101, a brand file that holds only comments is ignored with a warning instead of stopping the render (#14891). When this is the dark file of a light/dark brand, the HTML page still gets the light/dark color-scheme toggle, but no dark stylesheet is generated, so the toggle does nothing.

doc.qmd:

---
title: test
brand:
  light: light.yml
  dark: dark.yml
---

light.yml:

color:
  primary: "#ff0000"

dark.yml holds only comments. Same result with the brand: block in _quarto.yml.

With brand: {light: light.yml} (no dark key) there is no toggle, which is the expected output when the dark file is ignored.

The toggle is decided from the dark key in the brand metadata, not from the brand that was loaded:

if (metadata[kBrand] && typeof metadata[kBrand] === "object") {
const keys = Object.keys(metadata[kBrand]);
if (keys.includes("dark")) {
if (keys[0] === "dark") {
return true;
} else {
return false;
}
}

This is also used by website navigation, dashboards, giscus and brand Sass defaults, so the fix needs to keep explicit dark themes (theme: {light, dark}) working.

Activity

  1. added
    bugSomething isn't working
    brand`_brand.yml`
    dark-modedark mode and switching between light and dark modes
    on Oct 20, 2026
  2. self-assigned this
    on Oct 20, 2026
  3. added this to the v1.11 milestone on Oct 20, 2026
  4. added a commit that references this issue on Oct 20, 2026
    1836028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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