Skip to content

Commit

Permalink
fix(player): Improve styles when background color detection fails
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 28, 2024
1 parent ffb4f9d commit eea37ae
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions internal/movie/player_styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ func NewStyles(m *Movie, renderer *lipgloss.Renderer) Styles {
optionsColor := lipgloss.AdaptiveColor{Light: "7", Dark: "8"}
selectedColor := lipgloss.AdaptiveColor{Light: "12", Dark: "4"}

isTTY := renderer.Output().TTY() != nil
screenStyle := renderer.NewStyle().
Width(m.Width).
Height(m.Height).
Border(lipgloss.RoundedBorder()).
BorderForeground(borderColor)
if isTTY {
screenStyle = screenStyle.Foreground(lipgloss.AdaptiveColor{Light: "0", Dark: "15"})
}

s := Styles{
Screen: renderer.NewStyle().
Width(m.Width).
Height(m.Height).
Border(lipgloss.RoundedBorder()).
BorderForeground(borderColor).
Foreground(lipgloss.AdaptiveColor{Light: "0", Dark: "15"}),
Screen: screenStyle,

Progress: renderer.NewStyle().
Margin(1, 0).
Expand All @@ -40,13 +45,13 @@ func NewStyles(m *Movie, renderer *lipgloss.Renderer) Styles {
MarginBottom(1).
Border(lipgloss.InnerHalfBlockBorder()).
BorderForeground(optionsColor).
Background(optionsColor),
Background(optionsColor).
Foreground(lipgloss.AdaptiveColor{Light: "15", Dark: "7"}),
}

s.Active = s.Options.Copy().
Background(activeColor).
BorderForeground(activeColor).
Foreground(lipgloss.AdaptiveColor{Light: "15"}).
Bold(true)

s.Selected = s.Options.Copy().
Expand Down

0 comments on commit eea37ae

Please sign in to comment.