fix: add dirty hack to avoid white background.

This commit is contained in:
bratekarate 2024-10-02 21:43:42 +02:00
parent a22809f00e
commit 845e87b521
No known key found for this signature in database
GPG Key ID: 7FA4488395F8E7F3
1 changed files with 13 additions and 1 deletions

14
main.go
View File

@ -73,10 +73,22 @@ func highlight(w io.Writer, source, lexer, style string) error {
if err != nil {
return err
}
/* HACK: If background color is white, set to a reasonable, light grey
* default. */
if s.Get(chroma.Background).Background.String() == "#ffffff" {
senr := s.Get(chroma.Background)
senr.Background = chroma.ParseColour("#f6f8fa");
s, err = s.Builder().AddEntry(chroma.Background, senr).Build();
if err != nil {
return err
}
}
return f.Format(w, s, it)
}
const Version = "0.1"
const Version = "0.1.2"
func main() {
css := flag.String("css", "", "Path to a CSS import to include at the beginning of the output")