mirror of
https://github.com/brianstrauch/solitaire-tui.git
synced 2024-12-25 21:58:52 +01:00
make empty deck outline gray
This commit is contained in:
parent
3d203db0b9
commit
975129b164
2 changed files with 11 additions and 9 deletions
18
pkg/card.go
18
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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue