Init
This commit is contained in:
51
src/views/title_view.rs
Normal file
51
src/views/title_view.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
pub fn render(frame: &mut Frame, area: Rect) {
|
||||
let title_style = Style::new().fg(Color::Cyan).add_modifier(Modifier::BOLD);
|
||||
let subtitle_style = Style::new().fg(Color::White);
|
||||
let dim_style = Style::new()
|
||||
.fg(Color::Rgb(120, 125, 135))
|
||||
.add_modifier(Modifier::DIM);
|
||||
let link_style = Style::new().fg(Color::Rgb(100, 160, 180));
|
||||
|
||||
let lines = vec![
|
||||
Line::from(""),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled("seq", title_style)),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled("A Forth Music Sequencer", subtitle_style)),
|
||||
Line::from(""),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled("by BuboBubo", dim_style)),
|
||||
Line::from(Span::styled("Raphael Maurice Forment", dim_style)),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled("https://raphaelforment.fr", link_style)),
|
||||
Line::from(""),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled("AGPL-3.0", dim_style)),
|
||||
Line::from(""),
|
||||
Line::from(""),
|
||||
Line::from(""),
|
||||
Line::from(Span::styled(
|
||||
"Press any key to continue",
|
||||
Style::new().fg(Color::DarkGray),
|
||||
)),
|
||||
];
|
||||
|
||||
let text_height = lines.len() as u16;
|
||||
let vertical_padding = area.height.saturating_sub(text_height) / 2;
|
||||
|
||||
let [_, center_area, _] = Layout::vertical([
|
||||
Constraint::Length(vertical_padding),
|
||||
Constraint::Length(text_height),
|
||||
Constraint::Fill(1),
|
||||
])
|
||||
.areas(area);
|
||||
|
||||
let paragraph = Paragraph::new(lines).alignment(Alignment::Center);
|
||||
frame.render_widget(paragraph, center_area);
|
||||
}
|
||||
Reference in New Issue
Block a user