Skip to content

Commit

Permalink
Fix unknown-terminal-bg color handling
Browse files Browse the repository at this point in the history
Before this change, we just didn't highlight in this case.

With this change in place, we now fall back on the default dark theme
when background color detection fails.

Fixes <#202>.
  • Loading branch information
walles committed Apr 29, 2024
1 parent 4db6045 commit 52cf51f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion moar.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ func pagerFromArgs(
return nil, nil, chroma.Style{}, nil, nil
}

var style chroma.Style
var style chroma.Style = *styles.Get(defaultDarkTheme)
if *styleOption == nil {
t0 := time.Now()
screen.RequestTerminalBackgroundColor()
Expand Down Expand Up @@ -744,6 +744,7 @@ func pagerFromArgs(
} else {
style = **styleOption
}
log.Debug("Using style <", style.Name, ">")
reader.SetStyleForHighlighting(style)

pager := m.NewPager(reader)
Expand Down

0 comments on commit 52cf51f

Please sign in to comment.