"os"
"path"
"path/filepath"
+ "slices"
"strings"
"github.com/alecthomas/chroma/v2"
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
+ style = strings.ToLower(style)
+ if !slices.Contains(styles.Names(), style) {
+ return fmt.Errorf("invalid style: %s", style)
+ }
builder := styles.Get(style).Builder()
if highlightStyle != "" {
builder.Add(chroma.LineHighlight, highlightStyle)
hugo gen chromastyles -h
stdout 'Generate CSS stylesheet for the Chroma code highlighter'
hugo gen chromastyles --style monokai
-stdout '/\* LineHighlight \*/ \.chroma \.hl \{ background-color:#3c3d38 \}'
+stdout 'Generated using: hugo gen chromastyles --style monokai'
+! hugo gen chromastyles --style __invalid_style__
+stderr 'invalid style: __invalid_style__'