sunset theme.xml in favor of globals

This commit is contained in:
galister
2025-12-14 00:32:50 +09:00
parent 5035893fab
commit 17165123b9
11 changed files with 82 additions and 41 deletions

View File

@@ -125,6 +125,25 @@ impl Color {
pub fn debug_ansi_block(&self) -> String {
format!("{}███{}", self.debug_ansi_format(), ANSI_RESET_CODE)
}
#[must_use]
pub fn with_alpha(&self, n: f32) -> Self {
Self {
r: self.r,
g: self.g,
b: self.b,
a: n,
}
}
#[must_use]
pub fn to_hex(&self) -> String {
let r = (self.r.clamp(0.0, 1.0) * 255.0).round() as u8;
let g = (self.g.clamp(0.0, 1.0) * 255.0).round() as u8;
let b = (self.b.clamp(0.0, 1.0) * 255.0).round() as u8;
let a = (self.a.clamp(0.0, 1.0) * 255.0).round() as u8;
format!("#{r:02X}{g:02X}{b:02X}{a:02X}")
}
}
impl Default for Color {