From 975129b164ae8e56d69b68c5e8e00633fece4dac Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Mon, 16 Jan 2023 13:17:39 -0800 Subject: [PATCH] make empty deck outline gray --- pkg/card.go | 18 ++++++++++-------- pkg/deck.go | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pkg/card.go b/pkg/card.go index 0416643..fd1ba84 100644 --- a/pkg/card.go +++ b/pkg/card.go @@ -31,12 +31,18 @@ func NewCard(value, suit int) *Card { } func (c *Card) View() string { + color := "#000000" + + if c.IsSelected { + color = "#FFFF00" + } + if !c.IsVisible { - return viewCard("╱", "", c.IsSelected) + return viewCard("╱", "", color) } style := lipgloss.NewStyle().Foreground(lipgloss.Color(c.Color())) - return viewCard(" ", style.Render(c.String()), c.IsSelected) + return viewCard(" ", style.Render(c.String()), color) } func (c *Card) Flip() { @@ -55,12 +61,8 @@ func (c *Card) String() string { return values[c.Value] + suits[c.Suit] } -func viewCard(design, shorthand string, isSelected bool) string { - style := lipgloss.NewStyle() - if isSelected { - style = style.Foreground(lipgloss.Color("#FFFF00")) - } - +func viewCard(design, shorthand, color string) string { + style := lipgloss.NewStyle().Foreground(lipgloss.Color(color)) padding := strings.Repeat("─", width-2-lipgloss.Width(shorthand)) view := style.Render("╭") + shorthand + style.Render(padding+"╮") + "\n" diff --git a/pkg/deck.go b/pkg/deck.go index ef4fff2..7807411 100644 --- a/pkg/deck.go +++ b/pkg/deck.go @@ -45,7 +45,7 @@ func (d *Deck) Expand() { func (d *Deck) View() string { // Outline if d.Size() == 0 { - return viewCard(" ", "", false) + return viewCard(" ", "", "#EEEEEE") } // Expanded cards