Repository: gohugoio/hugo (language: go)

Issue:
commands: Add --lineNumbersTableStyle flag to gen chromastyles
The existing `--linesStyle` flag sets the foreground and background colors for inline line numbers. This flag has no effect when using `lineNumbersInTable=true`, and `lineNumbersInTable=true` is the default when `lineNos=true`. So, out of the box when enabling line numbers, you cannot set the line number foreground and background colors without manually editing the stylesheet.


Using `lineNumbersInTable=true` is desirable to work around this Firefox bug that is unlikely to ever be fixed:
<https://bugzilla.mozilla.org/show_bug.cgi?id=1273836>

At the same time, rename the existing `--linesStyle` flag to `--lineNumbersInlineStyle` for symmetry.





Discussion / hints:

Fix patch:
diff --git a/commands/gen.go b/commands/gen.go
index 476457fbeaa..b6ace80d94d 100644
--- a/commands/gen.go
+++ b/commands/gen.go
@@ -45,9 +45,10 @@ func newGenCommand() *genCommand {
 		genmandir string
 
 		// Chroma flags.
-		style          string
-		highlightStyle string
-		linesStyle     string
+		style                  string
+		highlightStyle         string
+		lineNumbersInlineStyle string
+		lineNumbersTableStyle  string
 	)
 
 	newChromaStyles := func() simplecobra.Commander {
@@ -63,8 +64,11 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
 				if highlightStyle != "" {
 					builder.Add(chroma.LineHighlight, highlightStyle)
 				}
-				if linesStyle != "" {
-					builder.Add(chroma.LineNumbers, linesStyle)
+				if lineNumbersInlineStyle != "" {
+					builder.Add(chroma.LineNumbers, lineNumbersInlineStyle)
+				}
+				if lineNumbersTableStyle != "" {
+					builder.Add(chroma.LineNumbersTable, lineNumbersTableStyle)
 				}
 				style, err := builder.Build()
 				if err != nil {
@@ -80,8 +84,10 @@ See https://xyproto.github.io/splash/docs/all.html for a preview of the availabl
 				_ = cmd.RegisterFlagCompletionFunc("style", cobra.NoFileCompletions)
 				cmd.PersistentFlags().StringVar(&highlightStyle, "highlightStyle", "", `foreground and background colors for highlighted lines, e.g. --highlightStyle "#fff000 bg:#000fff"`)
 				_ = cmd.RegisterFlagCompletionFunc("highlightStyle", cobra.NoFileCompletions)
-				cmd.PersistentFlags().StringVar(&linesStyle, "linesStyle", "", `foreground and background colors for inline line numbers, e.g. --linesStyle "#fff000 bg:#000fff"`)
-				_ = cmd.RegisterFlagCompletionFunc("linesStyle", cobra.NoFileCompletions)
+				cmd.PersistentFlags().StringVar(&lineNumbersInlineStyle, "lineNumbersInlineStyle", "", `foreground and background colors for inline line numbers, e.g. --lineNumbersInlineStyle "#fff000 bg:#000fff"`)
+				_ = cmd.RegisterFlagCompletionFunc("lineNumbersInlineStyle", cobra.NoFileCompletions)
+				cmd.PersistentFlags().StringVar(&lineNumbersTableStyle, "lineNumbersTableStyle", "", `foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"`)
+				_ = cmd.RegisterFlagCompletionFunc("lineNumbersTableStyle", cobra.NoFileCompletions)
 			},
 		}
 	}
diff --git a/docs/content/en/commands/hugo_gen_chromastyles.md b/docs/content/en/commands/hugo_gen_chromastyles.md
index 1970ed73613..6ecb00bd001 100644
--- a/docs/content/en/commands/hugo_gen_chromastyles.md
+++ b/docs/content/en/commands/hugo_gen_chromastyles.md
@@ -20,10 +20,11 @@ hugo gen chromastyles [flags] [args]
 ### Options
 
 ```
-  -h, --help                    help for chromastyles
-      --highlightStyle string   style used for highlighting lines (see https://github.com/alecthomas/chroma)
-      --linesStyle string       style used for line numbers (see https://github.com/alecthomas/chroma)
-      --style string            highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
+  -h, --help                            help for chromastyles
+      --highlightStyle string           foreground and background colors for highlighted lines, e.g. --highlightStyle "#fff000 bg:#000fff"
+      --lineNumbersInlineStyle string   foreground and background colors for inline line numbers, e.g. --lineNumbersInlineStyle "#fff000 bg:#000fff"
+      --lineNumbersTableStyle string    foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"
+      --style string                    highlighter style (see https://xyproto.github.io/splash/docs/) (default "friendly")
 ```
 
 ### Options inherited from parent commands


Test patch: