fix rgba construction

This commit is contained in:
yggverse 2024-12-04 10:59:18 +02:00
parent ed60b18760
commit 3f1e8a9780
2 changed files with 8 additions and 19 deletions

View File

@ -34,8 +34,8 @@ pub const LIST_ITEM: &str = "•";
pub const NEW_LINE: &str = "\n"; pub const NEW_LINE: &str = "\n";
// @TODO use accent colors in adw 1.6 / ubuntu 24.10+ // @TODO use accent colors in adw 1.6 / ubuntu 24.10+
const LINK_COLOR_DEFAULT: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 1.0); const LINK_COLOR_DEFAULT: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 255.0);
const LINK_COLOR_ONHOVER: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 0.9); const LINK_COLOR_ONHOVER: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 228.0);
pub struct Reader { pub struct Reader {
pub title: Option<String>, pub title: Option<String>,
@ -453,10 +453,6 @@ impl Reader {
/// Create new [RGBA](https://docs.gtk.org/gdk4/struct.RGBA.html) from tuple /// Create new [RGBA](https://docs.gtk.org/gdk4/struct.RGBA.html) from tuple
fn new_rgba_from(value: (f32, f32, f32, f32)) -> RGBA { fn new_rgba_from(value: (f32, f32, f32, f32)) -> RGBA {
// Extract values
let (r, g, b, a) = value; let (r, g, b, a) = value;
RGBA::new(r / 255.0, g / 255.0, b / 255.0, a / 255.0)
/* @TODO #1931
RGBA::new(r, g, b, a)*/
RGBA::parse(format!("rgba({r},{g},{b},{a})")).unwrap()
} }

View File

@ -119,19 +119,12 @@ impl Syntax {
// Tools // Tools
fn color_to_rgba(color: Color) -> RGBA { fn color_to_rgba(color: Color) -> RGBA {
/* @TODO #1931
RGBA::new( RGBA::new(
color.r.into(), color.r as f32 / 255.0,
color.g.into(), color.g as f32 / 255.0,
color.b.into(), color.b as f32 / 255.0,
color.a.into(), color.a as f32 / 255.0,
)*/ )
RGBA::parse(format!(
"rgba({},{},{},{})",
color.r, color.g, color.b, color.a
))
.unwrap()
} }
fn font_style_to_style(font_style: FontStyle) -> Style { fn font_style_to_style(font_style: FontStyle) -> Style {