#![allow(unused)] /// This file handles text-related settings. #[derive(Debug, Clone, Copy)] pub struct Color { r: u8, g: u8, b: u8, a: u8, } impl Color { pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self { Self { r, g, b, a } } pub fn new_noa(r: u8, g: u8, b: u8) -> Self { Self { r, g, b, a: 1u8 } } } #[derive(Debug, Clone, Copy)] pub struct TextStyle { bold: bool, italic: bool, font_size: u16, } impl TextStyle { pub fn default() -> Self { Self { bold: false, italic: false, font_size: 20, } } pub fn default_bold() -> Self { Self { bold: true, ..Self::default() } } pub fn default_italic() -> Self { Self { italic: true, ..Self::default() } } } #[derive(Debug, Clone)] pub struct TextSpan<'a> { pub text: &'a str, x: i32, y: i32, fg: Color, bg: Color, pub style: TextStyle, } impl<'a> TextSpan<'a> { pub fn new(text: &'a str, style: TextStyle) -> Self { Self { text, style, x: 0, y: 0, fg: Color::new_noa(255, 0, 0), bg: Color::new_noa(0, 0, 0), } } }