make empty deck outline gray

This commit is contained in:
Brian Strauch 2023-01-16 13:17:39 -08:00
parent 3d203db0b9
commit 975129b164
2 changed files with 11 additions and 9 deletions

View file

@ -31,12 +31,18 @@ func NewCard(value, suit int) *Card {
} }
func (c *Card) View() string { func (c *Card) View() string {
color := "#000000"
if c.IsSelected {
color = "#FFFF00"
}
if !c.IsVisible { if !c.IsVisible {
return viewCard("", "", c.IsSelected) return viewCard("", "", color)
} }
style := lipgloss.NewStyle().Foreground(lipgloss.Color(c.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() { func (c *Card) Flip() {
@ -55,12 +61,8 @@ func (c *Card) String() string {
return values[c.Value] + suits[c.Suit] return values[c.Value] + suits[c.Suit]
} }
func viewCard(design, shorthand string, isSelected bool) string { func viewCard(design, shorthand, color string) string {
style := lipgloss.NewStyle() style := lipgloss.NewStyle().Foreground(lipgloss.Color(color))
if isSelected {
style = style.Foreground(lipgloss.Color("#FFFF00"))
}
padding := strings.Repeat("─", width-2-lipgloss.Width(shorthand)) padding := strings.Repeat("─", width-2-lipgloss.Width(shorthand))
view := style.Render("╭") + shorthand + style.Render(padding+"╮") + "\n" view := style.Render("╭") + shorthand + style.Render(padding+"╮") + "\n"

View file

@ -45,7 +45,7 @@ func (d *Deck) Expand() {
func (d *Deck) View() string { func (d *Deck) View() string {
// Outline // Outline
if d.Size() == 0 { if d.Size() == 0 {
return viewCard(" ", "", false) return viewCard(" ", "", "#EEEEEE")
} }
// Expanded cards // Expanded cards