deps: Add Chroma dark/light mode support
Test / test (1.26.x, ubuntu-latest) (push) Has been cancelled
Test / test (1.26.x, windows-latest) (push) Has been cancelled

Closes #15017
This commit is contained in:
Bjørn Erik Pedersen
2026-06-09 13:38:19 +02:00
parent fe06735214
commit 790a8aa474
8 changed files with 389 additions and 105 deletions
-24
View File
@@ -8,27 +8,3 @@ hugo gen man -h
stdout 'up-to-date man pages'
hugo gen man --dir manpages
hugo gen chromastyles -h
stdout 'Generate CSS stylesheet for the Chroma code highlighter'
hugo gen chromastyles --style monokai
stdout 'Generated using: hugo gen chromastyles --style monokai'
! hugo gen chromastyles --style __invalid_style__
stderr 'invalid style: __invalid_style__'
# Not empty classes.
# From Hugo 0.149.0 empty classes are always removed, so no need for the omitEmpty flag.
hugo gen chromastyles --style monokai
! stdout '{ }'
hugo gen chromastyles --omitEmpty --style monokai --logLevel info
stderr 'deprecated: --omitEmpty was deprecated'
# Keep same-colour token classes in generated CSS. This is needed when pairing
# styles such as github and github-dark in dual-theme sites.
hugo gen chromastyles --style github-dark
stdout 'NameOther.*\.chroma \.nx \{ color:#e6edf3 \}'
# Disable class comments.
hugo gen chromastyles --style monokai
stdout 'GenericSubheading'
hugo gen chromastyles --omitClassComments --style monokai
! stdout 'GenericSubheading'
+25
View File
@@ -0,0 +1,25 @@
hugo gen chromastyles -h
stdout 'Generate CSS stylesheet for the Chroma code highlighter'
hugo gen chromastyles --style monokai
stdout 'Generated using: hugo gen chromastyles --style monokai'
! hugo gen chromastyles --style __invalid_style__
stderr 'invalid style: __invalid_style__'
# Not empty classes.
# From Hugo 0.149.0 empty classes are always removed, so no need for the omitEmpty flag.
hugo gen chromastyles --style monokai
! stdout '{ }'
hugo gen chromastyles --omitEmpty --style monokai --logLevel info
stderr 'deprecated: --omitEmpty was deprecated'
# Keep same-colour token classes in generated CSS. This is needed when pairing
# styles such as github and github-dark in dual-theme sites.
hugo gen chromastyles --style github-dark
stdout 'NameOther.*\.chroma \.nx \{ color:#e6edf3 \}'
# Disable class comments.
hugo gen chromastyles --style monokai
stdout 'GenericSubheading'
hugo gen chromastyles --omitClassComments --style monokai
! stdout 'GenericSubheading'
@@ -0,0 +1,24 @@
# Dark mode, no mode selector: plain ".chroma" selectors.
hugo gen chromastyles --style github --mode dark
stdout '\.chroma'
! stdout '\.dark'
# Dark mode for style with no dark mode.
! hugo gen chromastyles --style friendly --mode dark
stderr 'style "friendly" does not have a "dark" mode'
# Dark mode with mode selector: ".dark .chroma".
hugo gen chromastyles --style github --mode dark --modeSelector
stdout '\.dark \.chroma'
# Light mode with mode selector: ".light .chroma".
hugo gen chromastyles --style github --mode light --modeSelector
stdout '\.light \.chroma'
# --modeSelector without --mode on a default light style.
hugo gen chromastyles --style github --modeSelector
stdout '\.light \.chroma'
# --modeSelector without --mode on a default dark style.
hugo gen chromastyles --style ashen --modeSelector
stdout '\.dark \.chroma'