Skip to content

Comments

feat: Replace individual color options with color_scheme system (Seoul256 + Gruvbox)#360

Merged
mmcky merged 6 commits intomainfrom
feature/text-color-scheme
Feb 19, 2026
Merged

feat: Replace individual color options with color_scheme system (Seoul256 + Gruvbox)#360
mmcky merged 6 commits intomainfrom
feature/text-color-scheme

Conversation

@mmcky
Copy link
Contributor

@mmcky mmcky commented Feb 19, 2026

Summary

Replaces the 6 individual html_theme_options for emphasis/strong/definition colors (light + dark variants) with a single color_scheme option and a built-in palette system.

Motivation

The previous approach exposed 6 separate color options (emphasis_color, emphasis_color_dark, strong_color, etc.) which was complex to configure and lacked a cohesive design rationale. This PR simplifies configuration to a single option while shipping well-researched default palettes based on established vim color schemes.

Changes

New color_scheme theme option

Three built-in schemes:

Scheme Description
seoul256 (default) Dark teal for emphasis, dark amber for strong — inspired by the Seoul256 vim color scheme
gruvbox Aqua green for emphasis, burnt orange for strong — inspired by the Gruvbox color scheme
none Restores standard typography (italic em, bold strong, no color)

Seoul256 Colors

Element Light Mode Dark Mode
Emphasis (em) #005f5f dark teal (7.7:1 contrast) #5fafaf medium-light teal (5.5:1)
Bold/Strong (strong, b) #875f00 dark amber (5.4:1 contrast) #d7af5f light amber-gold (7.0:1)
Definitions (dl dt) Inherits from bold/strong Inherits from bold/strong

Gruvbox Colors

Element Light Mode Dark Mode
Emphasis (em) #427b58 aqua green (5.2:1 contrast) #8ec07c light aqua green (8.3:1)
Bold/Strong (strong, b) #af3a03 burnt orange (5.0:1 contrast) #fe8019 light orange (7.5:1)
Definitions (dl dt) Inherits from bold/strong Inherits from bold/strong

All colors meet WCAG AA contrast requirements.

Custom override support

Users can place a custom_color_scheme.css file in _static/ to override colors via CSS custom properties (--qe-emphasis-color, --qe-strong-color, --qe-definition-color). The theme auto-detects this file at build time.

Configuration

# conf.py
html_theme_options = {
    "color_scheme": "seoul256",  # or "gruvbox" or "none"
}
# _config.yml (Jupyter Book)
sphinx:
  config:
    html_theme_options:
      color_scheme: "seoul256"

Breaking Changes

The following html_theme_options have been removed:

  • emphasis_color / emphasis_color_dark
  • strong_color / strong_color_dark
  • definition_color / definition_color_dark

Migration: Remove these options and use color_scheme: "seoul256" (default) instead. For custom colors, place a custom_color_scheme.css file in _static/.

Files Changed

  • _colors.scss — Seoul256 + Gruvbox palette variables
  • _dark-theme.scss — Uses new SCSS dark-mode variables
  • _color-schemes.scss — New file defining gruvbox and none scheme classes
  • index.scss — Added @forward "color-schemes"
  • theme.conf — Replaced 6 color options with single color_scheme = seoul256
  • layout.html — Replaced per-color CSS variable injection with scheme-based class toggle
  • __init__.py — New validate_color_scheme() function, auto-detection of custom_color_scheme.css
  • test_custom_colors.py — Fully rewritten test suite for the new scheme system
  • test_module_structure.py — Added _color-schemes.scss to expected modules
  • configure.md — Updated documentation with scheme usage, color reference, and custom override instructions
  • CHANGELOG.md — Added unreleased entry with breaking changes
  • Visual snapshots — Updated italic-text and math-equation baselines

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 58.82353% with 7 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e41450f). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/quantecon_book_theme/__init__.py 58.82% 7 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #360   +/-   ##
=======================================
  Coverage        ?   45.92%           
=======================================
  Files           ?        2           
  Lines           ?      405           
  Branches        ?        0           
=======================================
  Hits            ?      186           
  Misses          ?      219           
  Partials        ?        0           
Flag Coverage Δ
pytests 45.92% <58.82%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

🎭 Visual Regression Test Results

passed  44 passed
flaky  1 flaky
skipped  1 skipped

Details

stats  46 tests across 1 suite
duration  1 minute, 3 seconds
commit  da2ed24

Flaky tests

desktop-chrome › theme.spec.ts › Theme Features › math equation rendering

Skipped tests

mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

@mmcky
Copy link
Contributor Author

mmcky commented Feb 19, 2026

/update-new-snapshots

@github-actions
Copy link
Contributor

✅ Visual snapshots have been updated and committed to this PR.

Replace 6 individual html_theme_options for emphasis/strong/definition
colors (light + dark) with a single 'color_scheme' option. Ships with
two built-in schemes:

- seoul256 (default): Dark teal (#005f5f) for emphasis, dark amber
  (#875f00) for strong, with matching light variants (#5fafaf, #d7af5f)
  for dark mode. Inspired by the Seoul256 vim color scheme.
- none: Restores standard typography (italic em, bold strong, no color).

Users can override colors via a custom_color_scheme.css file in _static/
using CSS custom properties (--qe-emphasis-color, --qe-strong-color,
--qe-definition-color). The theme auto-detects this file at build time.

Updated: SCSS colors, dark theme, layout template, theme.conf,
__init__.py validation, tests, docs, and CHANGELOG.
Add Gruvbox color palette alongside Seoul256:
- Earthy aqua (#427b58 / #8ec07c) for emphasis
- Warm orange (#af3a03 / #fe8019) for strong/definitions
- All colors WCAG AA compliant (5.0-8.3:1 contrast ratios)

Updated: _colors.scss, _color-schemes.scss, layout.html, __init__.py,
tests, docs, and CHANGELOG.
@mmcky mmcky force-pushed the feature/text-color-scheme branch from b216916 to f803033 Compare February 19, 2026 02:55
@mmcky
Copy link
Contributor Author

mmcky commented Feb 19, 2026

/update-snapshots

@github-actions
Copy link
Contributor

✅ All visual snapshots have been regenerated and committed to this PR.

A snapshot-update-diff artifact has been uploaded with the before/after comparison. Download it from the workflow run to review the visual changes.

- Remove [skip ci] from commit messages so snapshot updates trigger CI
- Add direct link to workflow run artifacts in /update-snapshots PR comment
@mmcky mmcky closed this Feb 19, 2026
@mmcky mmcky reopened this Feb 19, 2026
@github-actions
Copy link
Contributor

@github-actions github-actions bot temporarily deployed to pull request February 19, 2026 03:19 Inactive
@mmcky mmcky changed the title feat: Replace individual color options with color_scheme system (Seoul256) feat: Replace individual color options with color_scheme system (Seoul256 + Gruvbox) Feb 19, 2026
@mmcky mmcky merged commit 6f7c6c3 into main Feb 19, 2026
10 checks passed
@mmcky mmcky deleted the feature/text-color-scheme branch February 19, 2026 03:47
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.

1 participant