From 5e41a1499b9a4eb54529235252bc26ff12327be0 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 17 Dec 2024 03:43:40 +0200 Subject: [PATCH] remove extra conversion --- .../tab/item/page/content/text/gemini/reader.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 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 f6f77435..0848ec13 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, 255.0); -const LINK_COLOR_ONHOVER: (f32, f32, f32, f32) = (53.0, 132.0, 228.0, 228.0); +const LINK_COLOR: ((f32, f32, f32, f32), (f32, f32, f32, f32)) = + ((0.2, 0.5, 0.9, 1.0), (0.2, 0.5, 0.9, 0.9)); pub struct Reader { pub title: Option, @@ -63,10 +63,7 @@ impl Reader { let mut multiline = None; // Init colors - let link_color = ( - new_rgba_from(LINK_COLOR_DEFAULT), - new_rgba_from(LINK_COLOR_ONHOVER), - ); + let link_color = (rgba(LINK_COLOR.0), rgba(LINK_COLOR.1)); // Init syntect highlight features let syntax = Syntax::new(); @@ -458,7 +455,6 @@ impl Reader { // Private helpers /// Create new [RGBA](https://docs.gtk.org/gdk4/struct.RGBA.html) from tuple -fn new_rgba_from(value: (f32, f32, f32, f32)) -> RGBA { - let (r, g, b, a) = value; - RGBA::new(r / 255.0, g / 255.0, b / 255.0, a / 255.0) +fn rgba((r, g, b, a): (f32, f32, f32, f32)) -> RGBA { + RGBA::new(r, g, b, a) }