diff --git a/thecockpit/src/app.rs b/thecockpit/src/app.rs index c7a8805..4198d97 100644 --- a/thecockpit/src/app.rs +++ b/thecockpit/src/app.rs @@ -58,6 +58,7 @@ YJJJJJJJJJJJ???????????77777777777!!!!!!!!!!!~~~~~ const TABS: [&'static str; 3] = ["Whatzahoozits", "Thingamajigs", "Doohickeys"]; const NUMBERS: [u32; 3] = [0, 4, 9]; +const PASSWORD_BACKGROUND: Color = Color::Rgb(35, 35, 35); impl App { pub fn new() -> Self { @@ -92,12 +93,12 @@ impl App { { self.tab = Tab::Rest; self.transition_instant = Instant::now(); - self.current_effect = fx::fade_from_fg( - Color::Black, - ( - self.transition_instant.elapsed().as_secs() as u32 + 200000, - Interpolation::CircIn, - ), + self.current_effect = fx::slide_in( + tachyonfx::Motion::UpToDown, + 10, + 0, + PASSWORD_BACKGROUND, + (500000, Interpolation::Linear), ); self.binary_search_hint.guess_hint = None; } @@ -109,6 +110,7 @@ impl App { } pub fn draw_passcode(&mut self, frame: &mut Frame) { + frame.render_widget(Block::new().bg(PASSWORD_BACKGROUND), frame.area()); let middle_vertical = Layout::new( Direction::Vertical, [ @@ -157,7 +159,7 @@ impl App { Paragraph::new("Enter the secret code") .alignment(ratatui::layout::Alignment::Center) .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black), + .bg(PASSWORD_BACKGROUND), layout[0], ); frame.render_widget(&self.binary_search_hint, layout[1]); @@ -173,7 +175,7 @@ impl App { Paragraph::new(num) .block(Block::new().borders(Borders::all())) .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black), + .bg(PASSWORD_BACKGROUND), block, ); } @@ -182,7 +184,7 @@ impl App { Paragraph::new("Search the binary") .alignment(ratatui::layout::Alignment::Center) .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black), + .bg(PASSWORD_BACKGROUND), layout[3], ); } else { @@ -190,7 +192,7 @@ impl App { Paragraph::new("Maximize efficiency") .alignment(ratatui::layout::Alignment::Center) .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black), + .bg(PASSWORD_BACKGROUND), layout[3], ); } @@ -207,6 +209,7 @@ impl App { .select(self.selected_tab) .fg(Color::Rgb(226, 190, 89)) .bg(Color::Black) + .highlight_style(Style::new().bold()) .block(Block::new().borders(Borders::all()).title("Coming soon")), layout[0], ); @@ -258,7 +261,7 @@ impl App { fx::effect_fn((), (200000, Interpolation::CircIn), |_, _, cells| { cells.for_each(|(_, c)| c.fg = Color::Green); }), - fx::fade_to_fg(Color::Black, (200000, Interpolation::CircIn)), + fx::fade_to_fg(PASSWORD_BACKGROUND, (200000, Interpolation::CircIn)), ]); } } @@ -317,7 +320,7 @@ impl Widget for &BinarySearchHint { let number_on = (number_on as f64 * ruler_scale) as u32; let mut style = Style::default() .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black); + .bg(PASSWORD_BACKGROUND); if !self.range.contains(&number_on) { style = style.fg(Color::Rgb(117, 97, 42)); } @@ -328,7 +331,7 @@ impl Widget for &BinarySearchHint { let number_x = area.x + (*number_guessed as f64 / ruler_scale) as u16; let style = Style::default() .fg(Color::Rgb(226, 190, 89)) - .bg(Color::Black); + .bg(PASSWORD_BACKGROUND); buf.set_string(number_x, area.y, "|", style); match NUMBERS[self.number_to_guess].cmp(number_guessed) { Ordering::Less => buf.set_string(number_x, area.y + 1, "<", style), @@ -339,10 +342,10 @@ impl Widget for &BinarySearchHint { if let Some((last_guessed, guess_hint)) = self.guess_hint { let number_x = area.x + (last_guessed as f64 / ruler_scale) as u16; - let style = Style::default().fg(Color::Red).bg(Color::Black); + let style = Style::default().fg(Color::Red).bg(PASSWORD_BACKGROUND); buf.set_string(number_x, area.y, "✗", style); let number_x = area.x + (guess_hint as f64 / ruler_scale) as u16; - let style = Style::default().fg(Color::Green).bg(Color::Black); + let style = Style::default().fg(Color::Green).bg(PASSWORD_BACKGROUND); buf.set_string(number_x, area.y, "✓", style); } }