package ui import ( "strings" "github.com/charmbracelet/lipgloss" ) // A 5-row block font for the oversized detail-view scoreline. Each glyph is 6 // cells wide with 2-cell-thick strokes, so vertical strokes read as bold as // the horizontals — rendered with the full block rune for the app's signature // flair. const blockRows = 5 var blockGlyphs = map[rune][blockRows]string{ '0': {"██████", "██ ██", "██ ██", "██ ██", "██████"}, '1': {" ██ ", "████ ", " ██ ", " ██ ", "██████"}, '2': {"██████", " ██", "██████", "██ ", "██████"}, '3': {"██████", " ██", " █████", " ██", "██████"}, '4': {"██ ██", "██ ██", "██████", " ██", " ██"}, '5': {"██████", "██ ", "██████", " ██", "██████"}, '6': {"██████", "██ ", "██████", "██ ██", "██████"}, '7': {"██████", " ██", " ██ ", " ██ ", " ██ "}, '8': {"██████", "██ ██", "██████", "██ ██", "██████"}, '9': {"██████", "██ ██", "██████", " ██", "██████"}, '-': {" ", " ", "██████", " ", " "}, ' ': {" ", " ", " ", " ", " "}, } // blockNumber renders a string of digits (and '-'/' ') as a 5-row block, each // row a single string. Unknown runes render as blank glyphs. func blockNumber(s string) []string { rows := make([]string, blockRows) for i, r := range s { g, ok := blockGlyphs[r] if !ok { g = blockGlyphs[' '] } for row := 0; row < blockRows; row++ { if i > 0 { rows[row] += " " // 1-cell gap between glyphs } rows[row] += g[row] } } return rows } // blockScore renders "away - home" as one big colored block: away digits in // awayCol, home in homeCol, the dash muted. Returns a multi-line string. func blockScore(away, home string, awayCol, homeCol lipgloss.TerminalColor) string { render := func(s string, c lipgloss.TerminalColor) string { return lipgloss.NewStyle().Foreground(c).Bold(true). Render(strings.Join(blockNumber(s), "\n")) } gap := strings.Join(blockNumber(" "), "\n") dash := lipgloss.NewStyle().Foreground(colMuted).Render(strings.Join(blockNumber("-"), "\n")) return lipgloss.JoinHorizontal(lipgloss.Top, render(away, awayCol), gap, dash, gap, render(home, homeCol)) }