diff --git a/src/meson.build b/src/meson.build index f89cfb6..32e6d01 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,6 +3,7 @@ rust_sources = files( 'main.rs', 'pipewire_connection.rs', 'pipewire_connection/state.rs', + 'style.css', 'view/graph_view.rs', 'view/mod.rs', 'view/node.rs', diff --git a/src/style.css b/src/style.css index aae85c4..49619cd 100644 --- a/src/style.css +++ b/src/style.css @@ -1,14 +1,20 @@ +@define-color audio rgb(50,100,240); +@define-color video rgb(200,200,0); +@define-color midi rgb(200,0,50); +@define-color graphview-link black; +@define-color graphview-grid @text_view_bg; + .audio { - background: rgb(50,100,240); + background: @audio; color: black; } .video { - background: rgb(200,200,0); + background: @video; color: black; } .midi { - background: rgb(200,0,50); + background: @midi; color: black; -} +} \ No newline at end of file diff --git a/src/view/graph_view.rs b/src/view/graph_view.rs index 5f1f2a2..c2962a9 100644 --- a/src/view/graph_view.rs +++ b/src/view/graph_view.rs @@ -134,7 +134,7 @@ mod imp { .expect("Failed to get cairo context"); // Try to replace the background color with a darker one from the theme. - if let Some(rgba) = widget.style_context().lookup_color("text_view_bg") { + if let Some(rgba) = widget.style_context().lookup_color("graphview-grid") { background_cr.set_source_rgb(rgba.red.into(), rgba.green.into(), rgba.blue.into()); if let Err(e) = background_cr.paint() { warn!("Failed to paint graphview background: {}", e); @@ -175,8 +175,25 @@ mod imp { alloc.height as f32, )) .expect("Failed to get cairo context"); + link_cr.set_line_width(2.0); - link_cr.set_source_rgb(0.0, 0.0, 0.0); + + let gtk::gdk::RGBA { + red, + green, + blue, + alpha, + } = widget + .style_context() + .lookup_color("graphview-link") + .unwrap_or(gtk::gdk::RGBA { + red: 0.0, + green: 0.0, + blue: 0.0, + alpha: 0.0, + }); + link_cr.set_source_rgba(red.into(), green.into(), blue.into(), alpha.into()); + for (link, active) in self.links.borrow().values() { if let Some((from_x, from_y, to_x, to_y)) = self.get_link_coordinates(link) { link_cr.move_to(from_x, from_y);