From 3f1e8a97804ff03661a0dd6e64edd2e894aa434d Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 4 Dec 2024 10:59:18 +0200 Subject: [PATCH] fix rgba construction --- .../tab/item/page/content/text/gemini/reader.rs | 10 +++------- .../page/content/text/gemini/reader/syntax.rs | 17 +++++------------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs index 44f17428..57e8416f 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader.rs @@ -34,8 +34,8 @@ pub const LIST_ITEM: &str = "•"; pub const NEW_LINE: &str = "\n"; // @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_ONHOVER: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 0.9); +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, 228.0); pub struct Reader { pub title: Option, @@ -453,10 +453,6 @@ impl Reader { /// Create new [RGBA](https://docs.gtk.org/gdk4/struct.RGBA.html) from tuple fn new_rgba_from(value: (f32, f32, f32, f32)) -> RGBA { - // Extract values let (r, g, b, a) = value; - - /* @TODO #1931 - RGBA::new(r, g, b, a)*/ - RGBA::parse(format!("rgba({r},{g},{b},{a})")).unwrap() + RGBA::new(r / 255.0, g / 255.0, b / 255.0, a / 255.0) } diff --git a/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs b/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs index 12ff8250..4aa1ed82 100644 --- a/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs +++ b/src/app/browser/window/tab/item/page/content/text/gemini/reader/syntax.rs @@ -119,19 +119,12 @@ impl Syntax { // Tools fn color_to_rgba(color: Color) -> RGBA { - /* @TODO #1931 RGBA::new( - color.r.into(), - color.g.into(), - color.b.into(), - color.a.into(), - )*/ - - RGBA::parse(format!( - "rgba({},{},{},{})", - color.r, color.g, color.b, color.a - )) - .unwrap() + color.r as f32 / 255.0, + color.g as f32 / 255.0, + color.b as f32 / 255.0, + color.a as f32 / 255.0, + ) } fn font_style_to_style(font_style: FontStyle) -> Style {