Skip to content

Treat a null $body-bg or $body-color as unset in Bootstrap variables - #15345

Open
SAMARTHJAISWAL wants to merge 1 commit into
quarto-dev:mainfrom
SAMARTHJAISWAL:fix/null-body-bg
Open

SAMARTHJAISWAL wants to merge 1 commit into
quarto-dev:mainfrom
SAMARTHJAISWAL:fix/null-body-bg

Conversation

@SAMARTHJAISWAL

Copy link
Copy Markdown

Description

Fixes #15304.

A theme that declares $body-bg: null !default; or $body-color: null !default; broke theme compilation ($color: null is not a color). Dart Sass recommends that declaration before setting a variable conditionally. variable-exists() is true for a variable that holds null, so the Bootstrap variables used the null value instead of falling back.

This adds and $body-bg != null / and $body-color != null to each of these checks, the same way the $pre-color check already does. The checks are in _bootstrap-variables.scss, _bootstrap-functions.scss (morph, cyborg) and _quarto-variables-copy-code.scss. The two $popover-bg / $input-bg checks fall back to null anyway, so I left them unchanged. Bootstrap's own !default then fills in the null variables, so the page gets Bootstrap's default body colours.

Tested:

  • New smoke test tests/docs/smoke-all/2026/11/12/issue-15304.qmd: fails on main because the render errors, and passes with this change.
  • Ran the dark-mode, brand/color and earlier theme smoke tests locally. Everything that doesn't need R or Python passes (29). The 14 I couldn't run here need R or Jupyter, which aren't installed on my machine.
  • Rendered the cyborg, morph and darkly themes, and cyborg with the null override.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR (not needed, no behaviour or docs change beyond the fix)
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

@posit-snyk-bot

posit-snyk-bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

A theme that declares `$body-bg: null !default;` (as Dart Sass recommends
before setting a variable conditionally) made `variable-exists()` true, so
Quarto used the null value and theme compilation failed. Check for null too,
as the `$pre-color` fallback already does.

Fixes quarto-dev#15304
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Theme compilation fails when a theme declares $body-bg or $body-color as null

2 participants