Skip to content

Commit

Permalink
fix: use const colors to skip reading querying for the terminal bg color
Browse files Browse the repository at this point in the history
Don't use AdaptiveColors and use regular colors instead. This makes the
default styles _not_ use HasDarkBackground to determine the terminal
background color. HasDarkBackground will query the terminal for the
background color using `OSC 11` to determine which color to use in
AdaptiveColor.

For users who still want to use AdaptiveColors, they can supply their
own custom styles.

Fixes: #90
  • Loading branch information
aymanbagabas committed Nov 22, 2023
1 parent f36448c commit 9d027f0
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,27 @@ func DefaultStyles() *Styles {
SetString(strings.ToUpper(DebugLevel.String())).
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "63",
Dark: "63",
}),
Foreground(lipgloss.Color("63")),
InfoLevel: lipgloss.NewStyle().
SetString(strings.ToUpper(InfoLevel.String())).
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "39",
Dark: "86",
}),
Foreground(lipgloss.Color("86")),
WarnLevel: lipgloss.NewStyle().
SetString(strings.ToUpper(WarnLevel.String())).
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "208",
Dark: "192",
}),
Foreground(lipgloss.Color("192")),
ErrorLevel: lipgloss.NewStyle().
SetString(strings.ToUpper(ErrorLevel.String())).
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "203",
Dark: "204",
}),
Foreground(lipgloss.Color("204")),
FatalLevel: lipgloss.NewStyle().
SetString(strings.ToUpper(FatalLevel.String())).
Bold(true).
MaxWidth(4).
Foreground(lipgloss.AdaptiveColor{
Light: "133",
Dark: "134",
}),
Foreground(lipgloss.Color("134")),
},
Keys: map[string]lipgloss.Style{},
Values: map[string]lipgloss.Style{},
Expand Down

0 comments on commit 9d027f0

Please sign in to comment.