Skip to content

A dark code-block background does not trigger the dark highlighting variant #14640

Description

@cwickham

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

The HTML code docs state that the highlighting variant is chosen from the code block background:

When available, Quarto will automatically select the appropriate style based upon the code chunk background color's darkness.

When I explicitly set a dark code background with brand, I still get the light highlighting variant.

It's possible that rather than a bug, the docs need clarifying. I.e. the situation that does work (I think), is when a light and dark theme/brand are invoked, the light/dark syntax highlighting variants are automatically switched.

Steps to reproduce

---
title: "Dark code background via brand"
format:
  html:
    syntax-highlighting: arrow
brand:
  typography:
    monospace-block:
      background-color: "#252323"
---

```r
x <- mean(c(1, 2, 3))
```

Actual behavior

The code block renders with the dark background (#252323) but the light arrow highlighting variant, so syntax tokens use dark-on-light colors (e.g. #003B4F, #AD0000) that are barely legible on the dark block.

Image

Expected behavior

Per the docs, a dark code-block background should select the dark highlighting variant (arrow-dark), so syntax tokens are light-on-dark and legible — independent of the page/body background color.

Image

Your environment

  • IDE: command line / terminal (also reproduces with Positron's bundled Quarto)
  • OS: macOS 26.5.1 (Apple Silicon)

Quarto check output

Quarto 1.9.38
[✓] Checking environment information...
      Quarto cache location: /Users/charlottewickham/Library/Caches/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.8.3: OK
      Dart Sass version 1.87.0: OK
      Deno version 2.4.5: OK
      Typst version 0.14.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.9.38
      Path: /Applications/Positron.app/Contents/Resources/app/quarto/bin
[✓] Checking tools....................OK
      TinyTeX: v2026.04
      VeraPDF: 1.28.2
      Chromium: (not installed)
      Chrome Headless Shell: (not installed)
[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/charlottewickham/Library/TinyTeX/bin/universal-darwin
      Version: 2026
[✓] Checking Chrome Headless....................OK
      Using: Chrome found on system
      Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
      Source: MacOS known location
[✓] Checking basic markdown render....OK
[✓] Checking R installation...........OK
      Version: 4.5.1
      Path: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources
      knitr: 1.51
      rmarkdown: 2.30
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
      Version: 3.12.2
      Path: /Users/charlottewickham/.pyenv/versions/3.12.2/bin/python3
      Jupyter: 5.9.1
      Kernels: python3
[✓] Checking Jupyter engine render....OK
[✓] Checking Julia installation...OK

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghtmlIssues with HTML and related web technology (html/css/scss/js)themesRelated to HTML theming or any other style related issue (like highlight-style)

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions