remove extra conversion

This commit is contained in:
yggverse 2024-12-17 03:43:40 +02:00
parent 048d6830e1
commit 5e41a1499b

View File

@ -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<String>,
@ -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)
}