Dark syntax highlighting themes don't override light theme's base .sourceCode text color
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- typescript
- 領域
- frontend
調査の方向性
src/command/render/pandoc-html.ts の generateThemeCssClasses() から始め、zenburn と espresso のテーマファイルにあるトップレベルのテキストカラーのフィールドと、Normal スタイルの処理を比較します。提供されている明色/暗色の _quarto.yml の再現を使用し、生成された暗色テーマの CSS に、Normal エントリを持たないテーマ向けの読みやすいベースの span カラーが含まれていることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Description
When using light/dark theme toggling, certain dark syntax highlighting themes (zenburn, espresso) don't generate a base .sourceCode > span text color rule. The light theme's near-black base color persists in dark mode, making code tokens without a specific highlighting class invisible.
Root Cause
The bug is in generateThemeCssClasses(), not in the theme files. The function only emits the .sourceCode > span base color rule when it finds a "Normal" key in "text-styles". It never checks the top-level "text-color" as a fallback.
kate (light theme) has "Normal" in "text-styles":
"text-styles": {
"Normal": {"text-color": "#1f1c1b", ...}
}
→ Generates .sourceCode > span { color: #1f1c1b; }
zenburn (dark theme) is a valid Pandoc/KDE theme file — it defines "text-color": "#cccccc" at the top level, which is how these theme files can specify the default text color. But it has no "Normal" entry in "text-styles":
{
"text-color": "#cccccc",
"background-color": "#303030",
"text-styles": {
"Alert": {...},
"Keyword": {...},
...
// no "Normal" key
}
}
→ No base .sourceCode > span rule is generated.
Since Quarto layers dark CSS on top of light (// note: dark is layered on light, we don't disable primary!), the light theme's .sourceCode > span { color: #1f1c1b; } persists unchallenged in dark mode.
Note: the triple-stylesheet issue from #13450 is unrelated — Puppeteer testing confirms the quarto-color-scheme-extra sheets are properly disabled by JS on page load and don't cause this problem.
Affected Themes
7 themes are missing "Normal" in text-styles: espresso, haddock, monochrome, none, pygments, tango, zenburn.
Of the dark themes, espresso and zenburn are both affected — they define a top-level text-color but no "Normal" style. Any user-created custom theme with the same valid structure would also break silently.
Reproduction
# _quarto.yml
format:
html:
theme:
light: cosmo
dark: darkly
highlight-style:
light: kate
dark: zenburn
Any code block with tokens that don't get a specific span class (e.g., plain identifiers, punctuation) will be unreadable in dark mode:
Proposed Fix
In generateThemeCssClasses(), after processing text-styles, fall back to the theme's top-level "text-color" when no "Normal" style was found:
// After the Object.keys(textStyles).forEach loop:
if (!tokenCssByAbbr[""] && themeJson["text-color"]) {
const cssValues = [` color: ${themeJson["text-color"]};`, " font-style: inherit;"];
toCSS("", "Normal", cssValues);
["pre > code.sourceCode > span", "code.sourceCode > span",
"div.sourceCode,\ndiv.sourceCode pre.sourceCode"]
.forEach((selector) => {
otherLines.push(`\n${selector} {`);
otherLines.push(...cssValues);
otherLines.push("}\n");
});
}
Verified by creating a patched zenburn theme with "Normal" added (simulating the fix output) — dark highlighting CSS then emits .sourceCode > span { color: #cccccc; } and all code tokens are readable without any custom SCSS workarounds.
Workaround
body.quarto-dark {
pre.sourceCode,
.sourceCode > span,
code.sourceCode > span {
color: #dcdccc;
}
}
Environment
- Quarto 1.8.27
- macOS, Chrome/Safari
- 主要言語
- JavaScript
- スター
- 6k
- フォーク
- 458
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 41
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
quarto-dev/quarto-cli のほかの issue
-
binder bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
quarto-dev/quarto-cli#14907 · コメント 3 件 ·
-
brand bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
quarto-dev/quarto-cli#14891 ·
-
brand bug html revealjs
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
quarto-dev/quarto-cli#14882 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
quarto-dev/quarto-cli#14875 ·
-
Percent scripts: accept raw-string (r""") and '''-delimited markdown cells, as jupytext writes them オープンengines-jupyter enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
quarto-dev/quarto-cli#14850 · コメント 2 件 ·
quarto-dev/quarto-cli の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
babalae/bettergi-scripts-list#3674 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
githubnext/gh-aw-cao#13143 ·