Skip to content

Commit 127dd77

Browse files
unhappychoiceclaude
andcommitted
feat(ui): improve title screen key organization and styling
- Organize key explanations into sections (Navigation/Actions/Exit) - Unify Info-related navigation colors to Cyan - Apply DIM attribute to secondary difficulty text for better hierarchy - Use different colors with DIM for improved readability 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 973b48d commit 127dd77

File tree

1 file changed

+32
-11
lines changed

1 file changed

+32
-11
lines changed

src/game/screens/title_screen.rs

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use std::io::{stdout, Write};
1414
pub enum TitleAction {
1515
Start(DifficultyLevel),
1616
History,
17+
Analytics,
1718
Quit,
1819
}
1920

@@ -120,6 +121,9 @@ impl TitleScreen {
120121
KeyCode::Char('r') | KeyCode::Char('R') => {
121122
return Ok(TitleAction::History);
122123
}
124+
KeyCode::Char('a') | KeyCode::Char('A') => {
125+
return Ok(TitleAction::Analytics);
126+
}
123127
_ => {}
124128
}
125129
}
@@ -162,28 +166,45 @@ impl TitleScreen {
162166
execute!(stdout, Print(subtitle))?;
163167
execute!(stdout, ResetColor)?;
164168

165-
// Display instructions with color coding (keys only)
166-
let total_instructions_len =
167-
"[←→/HL] Change [SPACE] Start [R] History [I/?] Info [ESC] Quit".len();
168-
let instructions_col = center_col.saturating_sub(total_instructions_len as u16 / 2);
169-
170-
execute!(stdout, MoveTo(instructions_col, center_row + 6))?;
169+
// Display instructions in organized sections
170+
let instructions_start_row = center_row + 6;
171+
172+
// Navigation section
173+
let nav_text = "[←→/HL] Change [SPACE] Start";
174+
let nav_col = center_col.saturating_sub(nav_text.len() as u16 / 2);
175+
execute!(stdout, MoveTo(nav_col, instructions_start_row))?;
171176
execute!(stdout, SetForegroundColor(Color::Blue))?;
172177
execute!(stdout, Print("[←→/HL]"))?;
173178
execute!(stdout, SetForegroundColor(Color::White))?;
174179
execute!(stdout, Print(" Change "))?;
175180
execute!(stdout, SetForegroundColor(Color::Green))?;
176181
execute!(stdout, Print("[SPACE]"))?;
177182
execute!(stdout, SetForegroundColor(Color::White))?;
178-
execute!(stdout, Print(" Start "))?;
179-
execute!(stdout, SetForegroundColor(Color::Magenta))?;
183+
execute!(stdout, Print(" Start"))?;
184+
execute!(stdout, ResetColor)?;
185+
186+
// Actions section
187+
let actions_text = "[R] History [A] Analytics [I/?] Info";
188+
let actions_col = center_col.saturating_sub(actions_text.len() as u16 / 2);
189+
execute!(stdout, MoveTo(actions_col, instructions_start_row + 1))?;
190+
execute!(stdout, SetForegroundColor(Color::Cyan))?;
180191
execute!(stdout, Print("[R]"))?;
181192
execute!(stdout, SetForegroundColor(Color::White))?;
182193
execute!(stdout, Print(" History "))?;
183194
execute!(stdout, SetForegroundColor(Color::Cyan))?;
195+
execute!(stdout, Print("[A]"))?;
196+
execute!(stdout, SetForegroundColor(Color::White))?;
197+
execute!(stdout, Print(" Analytics "))?;
198+
execute!(stdout, SetForegroundColor(Color::Cyan))?;
184199
execute!(stdout, Print("[I/?]"))?;
185200
execute!(stdout, SetForegroundColor(Color::White))?;
186-
execute!(stdout, Print(" Info "))?;
201+
execute!(stdout, Print(" Info"))?;
202+
execute!(stdout, ResetColor)?;
203+
204+
// Exit section
205+
let exit_text = "[ESC] Quit";
206+
let exit_col = center_col.saturating_sub(exit_text.len() as u16 / 2);
207+
execute!(stdout, MoveTo(exit_col, instructions_start_row + 2))?;
187208
execute!(stdout, SetForegroundColor(Color::Red))?;
188209
execute!(stdout, Print("[ESC]"))?;
189210
execute!(stdout, SetForegroundColor(Color::White))?;
@@ -242,7 +263,7 @@ impl TitleScreen {
242263
let count_col = center_col.saturating_sub(count_text.chars().count() as u16 / 2);
243264

244265
execute!(stdout, MoveTo(count_col, start_row + 1))?;
245-
execute!(stdout, SetForegroundColor(Color::Cyan))?;
266+
execute!(stdout, SetForegroundColor(Color::Cyan), SetAttribute(Attribute::Dim))?;
246267
execute!(stdout, Print(count_text))?;
247268
execute!(stdout, ResetColor)?;
248269

@@ -251,7 +272,7 @@ impl TitleScreen {
251272
for (i, description) in descriptions.iter().enumerate() {
252273
let desc_col = center_col.saturating_sub(description.chars().count() as u16 / 2);
253274
execute!(stdout, MoveTo(desc_col, start_row + 2 + i as u16))?;
254-
execute!(stdout, SetForegroundColor(Color::Grey))?;
275+
execute!(stdout, SetForegroundColor(Color::White), SetAttribute(Attribute::Dim))?;
255276
execute!(stdout, Print(description))?;
256277
execute!(stdout, ResetColor)?;
257278
}

0 commit comments

Comments
 (0)