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

オープン 初心者向け
#15,304 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
sass, scss
領域
build-system

調査の方向性

issue でリンクされている2つのチェック箇所から src/resources/formats/html/bootstrap/_bootstrap-variables.scss を確認し、既存の pre-color の null チェックと比較してください。提供されている custom.scss と index.qmd の例を使い、quarto render index.qmd で再現してください。$body-bg または $body-color を null として宣言するテーマが、ドキュメントに記載されたフォールバックでレンダリングされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bootstrap bug themes
I have:
  • searched the issue tracker for similar issues
  • installed the latest version of Quarto CLI
  • formatted my issue following the Bug Reports guide
Bug description

Quarto's Bootstrap variables test variable-exists(body-bg) and variable-exists(body-color) to decide whether a theme has set them.
variable-exists() is true for a variable that holds null, so a theme that declares $body-bg: null !default; makes $body-contrast-bg null, and compilation stops.

The pre-color check a few lines above already handles this case with variable-exists(pre-color) and $pre-color != null:

A null declaration at the root is what Dart Sass itself recommends.
A theme that sets $body-bg only under some condition has to declare it first, or use !global inside the @if, which Dart Sass flags as deprecated:

DEPRECATION WARNING [new-global]: As of Dart Sass 2.0.0, !global assignments won't be able to declare new variables.

Recommendation: add `$body-bg: null` at the stylesheet root.

Following that advice breaks the render, so the theme is stuck with the deprecation.
I also tried $primary: null !default;, and that one renders.

Steps to reproduce

custom.scss:

/*-- scss:defaults --*/
$body-bg: null !default;

index.qmd:

---
title: "Null body-bg"
format:
  html:
    theme: [default, custom.scss]
---

Hello.

Run quarto render index.qmd.
Replace $body-bg with $body-color for the second error.

Actual behavior

With $body-bg: null !default;:

ERROR: Theme file compilation failed:

Error: $color: null is not a color.
    ╷
827 │   $red: _linear-channel-value(quarto-color.red($color));
    │                               ^^^^^^^^^^^^^^^^^^^^^^^^
    ╵
  ... 827:31   luminance()
  ... 837:13   quarto-contrast()
  ... 854:19   tone()
  ... 508:7    theme-contrast()

With $body-color: null !default; and the default theme:

Error: $color1: null is not a color.
Expected behavior

A null value counts as "not set", as it already does for $pre-color.
Quarto falls back to $white and $gray-900, and the document renders.

Your environment
  • IDE: none, command line.
  • OS: macOS 27.2.
Quarto check output

Reproduced with a development build of main at 089ba530b.
The two lines above are the same at the v1.11.9 tag.

Quarto 99.9.9
[✓] Checking environment information...
      Quarto cache location: /Users/mcanouil/Library/Caches/quarto
      Project: none found (single-file mode)
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.10.0: OK
      Dart Sass version 1.107.1: OK
      Deno version 2.9.8: OK
      Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      commit: 089ba530b3ed4ec156a355d41b6b7de2db3e44ea
      Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin
[✓] Checking tools....................OK
      TinyTeX: v2026.07
      Chrome Headless Shell: (not installed)
      VeraPDF: (not installed)
[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
      Version: 2026
[✓] Checking Chrome Headless....................OK
      Using: Chrome from QUARTO_CHROMIUM
      Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
[✓] Checking basic markdown render....OK
主要言語
JavaScript
スター
6.1k
フォーク
478
平均マージ
17時間 53分
マージ済み PR(30日)
135

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quarto-dev/quarto-cli のほかの issue

quarto-dev/quarto-cli の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。