quarto-dev / quarto-dev/quarto-cli

Make Bootswatch paired light and dark themes available

Open
#6,741 10 comments 28 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dark-mode enhancement html themes
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/6740

Originally posted by allefeld September 6, 2023

Description

For many of the Bootswatch themes there seem to be paired light and dark versions. For example, on the Cosmo theme page https://bootswatch.com/cosmo/ there is a switch in the upper right corner which toggles between the standard light version and a version which retains fonts, formatting, and many colors, but has light-on-dark text.

I tried to implement that for my own website using

    theme:
      light: cosmo
      dark: cosmo

and

    theme:
      light: cosmo
      dark: cosmo-dark

or

    theme:
      light: cosmo
      dark: cosmo_dark

but none of these work.

I downloaded the source code from the light and the dark version of the Cosmo theme page and compared the files, and the only difference seems to be that the html element has an additional attribute data-bs-theme="dark". Manipulating that manually via the inspector works on the Bootswatch theme page, but it does not work on Quarto-generated pages.

It would be nice if there was a way to take advantage of these paired themes in Quarto, instead of pairing two different light and dark themes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the YAML theme configuration examples and compare Quarto-generated HTML with Bootswatch's Cosmo light and dark pages, focusing on the html data-bs-theme attribute. Done means a paired light/dark Bootswatch theme can be selected through Quarto without manually editing generated HTML.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.