- commit
- cd468a65d38dc0df5a9c36ed44852671816a57da
- parent
- 8e2e77682eed7fffd2176477771f59df53185626
- author
- Dami <dami.etoile@gmail.com>
| M | nonogram/ | 25 | ++++++++++++++++--------- |
| M | sudoku/ | 2 | +- |
| M | sudoku/ | 12 | +++++++++++- |
@@ -28,8 +28,9 @@ var (
2828 Foreground(lipgloss.AdaptiveColor{Light: "255", Dark: "235"}).2929 Background(lipgloss.AdaptiveColor{Light: "130", Dark: "214"})3030 31- crosshairBG = lipgloss.AdaptiveColor{Light: "254", Dark: "237"}32- solvedBG = lipgloss.AdaptiveColor{Light: "151", Dark: "22"}31+ crosshairBG = lipgloss.AdaptiveColor{Light: "254", Dark: "237"}32+ crosshairFilledBG = lipgloss.AdaptiveColor{Light: "223", Dark: "100"}33+ solvedBG = lipgloss.AdaptiveColor{Light: "151", Dark: "22"}3334 3435 hintStyle = baseStyle.3536 Foreground(lipgloss.AdaptiveColor{Light: "137", Dark: "137"})@@ -127,10 +128,12 @@ func colHintView(c TomographyDefinition, height int, current ...TomographyDefini
127128 128129 if needsSpacer(i, n) {129130 sepStyle := baseStyle.Foreground(separatorFG)130- col := lipgloss.JoinVertical(lipgloss.Left,131- strings.Split(strings.Repeat("│\n", height), "\n")[:height]...,132- )133- renderedCols = append(renderedCols, sepStyle.Render(col))131+ var lines []string132+ for range height - 1 {133+ lines = append(lines, " ")134+ }135+ lines = append(lines, sepStyle.Render("│"))136+ renderedCols = append(renderedCols, lipgloss.JoinVertical(lipgloss.Left, lines...))134137 }135138 }136139 return lipgloss.JoinHorizontal(lipgloss.Top, renderedCols...)@@ -168,7 +171,7 @@ func rowHintView(r TomographyDefinition, width int, current ...TomographyDefinit
168171 sep := baseStyle.Foreground(separatorFG).169172 Width(width).170173 Align(lipgloss.Right).171- Render(strings.Repeat("─", width))174+ Render("─")172175 renderedRows = append(renderedRows, sep)173176 }174177 }@@ -234,8 +237,12 @@ func tileView(val rune, isCursor, inCursorRow, inCursorCol, solved bool) string
234237 if isCursor && !solved {235238 s = cursorStyle236239 } else if !solved && (inCursorRow || inCursorCol) {237- // Apply crosshair background tint238- s = s.Background(crosshairBG)240+ // Apply crosshair background tint — filled cells get a more active color241+ if val == filledTile {242+ s = s.Background(crosshairFilledBG)243+ } else {244+ s = s.Background(crosshairBG)245+ }239246 }240247 241248 if solved {@@ -95,7 +95,7 @@ func (m Model) View() string {
9595 grid := renderGrid(m, solved, conflicts)9696 status := statusBarView(m.showFullHelp)9797 98- return lipgloss.JoinVertical(lipgloss.Left, title, grid, status)98+ return lipgloss.JoinVertical(lipgloss.Center, title, grid, status)9999 }100100 101101 // GetDebugInfo implements game.Gamer.@@ -32,6 +32,10 @@ var (
3232 Foreground(lipgloss.AdaptiveColor{Light: "160", Dark: "167"}).3333 Background(lipgloss.AdaptiveColor{Light: "224", Dark: "52"})3434 35+ sameNumberStyle = lipgloss.NewStyle().36+ Bold(true).37+ Foreground(lipgloss.AdaptiveColor{Light: "130", Dark: "187"})38+3539 crosshairBG = lipgloss.AdaptiveColor{Light: "254", Dark: "237"}3640 3741 boxBorderFG = lipgloss.AdaptiveColor{Light: "250", Dark: "240"}@@ -105,7 +109,9 @@ func renderGrid(m Model, solved bool, conflicts [gridSize][gridSize]bool) string
105109 }106110 107111 func getCellStyle(m Model, c cell, x, y int, conflict bool) lipgloss.Style {108- // Priority: cursor > conflict > provided > user > empty112+ cursorVal := m.grid[m.cursor.Y][m.cursor.X].v113+114+ // Priority: cursor > conflict > same number > provided > user > empty109115 if m.cursor.X == x && m.cursor.Y == y {110116 return cursorCellStyle111117 }@@ -114,6 +120,10 @@ func getCellStyle(m Model, c cell, x, y int, conflict bool) lipgloss.Style {
114120 return conflictCellStyle115121 }116122 123+ if cursorVal != 0 && c.v == cursorVal {124+ return sameNumberStyle125+ }126+117127 isProvided := m.providedGrid[y][x]118128 inCursorRow := m.cursor.Y == y119129 inCursorCol := m.cursor.X == x