From fb3a4a0d19015b0881563e16d00a0f8166fc7e7e Mon Sep 17 00:00:00 2001 From: Rahix Date: Thu, 22 May 2025 09:45:33 +0200 Subject: [PATCH] tree: Improve dot styling Use the same/similar styles that we use for mermaid. --- techtree-manager/src/tree.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/techtree-manager/src/tree.rs b/techtree-manager/src/tree.rs index 44b8be0..e65410b 100644 --- a/techtree-manager/src/tree.rs +++ b/techtree-manager/src/tree.rs @@ -27,19 +27,21 @@ impl Element { let mut attributes = Vec::new(); attributes.push(format!( - r##"label = "{{{{#{issue_number} | {status}}}|{ty}|{description}}}""## + r##"label = <{{{{#{issue_number} | {status}}}|{ty}|{description}}}>"## )); attributes.push(r#"shape = "record""#.to_owned()); - let color = match (role, status) { - (Some(SubtreeElementRole::ElementOfInterest), _) => "black", - (Some(SubtreeElementRole::Dependant), _) => "gray", - (_, ElementStatus::Missing) => "darkred", - (_, ElementStatus::Assigned) => "orange", - (_, ElementStatus::Completed) => "darkgreen", + let (color, background) = match (role, status) { + (Some(SubtreeElementRole::ElementOfInterest), _) => ("black", "white"), + (Some(SubtreeElementRole::Dependant), _) => ("gray", "gray"), + (_, ElementStatus::Missing) => ("#800", "#fcc"), + (_, ElementStatus::Assigned) => ("#a50", "#ffa"), + (_, ElementStatus::Completed) => ("#080", "#afa"), }; attributes.push(format!(r#"color = "{color}""#)); attributes.push(format!(r#"fontcolor = "{color}""#)); + attributes.push(format!(r#"fillcolor = "{background}""#)); + attributes.push(format!(r#"style = "filled""#)); attributes.join(", ") }