fix(theme): gtk3 css doesn't allow hex colors with alpha

This commit is contained in:
Ashley Wulber 2024-05-24 20:40:18 -04:00 committed by Jeremy Soller
parent 428dafe37c
commit 8b0bb6a677
2 changed files with 79 additions and 71 deletions

View file

@ -47,3 +47,11 @@ pub fn to_hex(c: Srgba) -> String {
c_u8.red, c_u8.green, c_u8.blue, c_u8.alpha
)
}
pub fn to_rgba(c: Srgba) -> String {
let c_u8: Rgba<palette::encoding::Srgb, u8> = c.into_format();
format!(
"rgba({}, {}, {}, {:1.2})",
c_u8.red, c_u8.green, c_u8.blue, c.alpha
)
}