tree: Improve dot styling

Use the same/similar styles that we use for mermaid.
This commit is contained in:
Rahix 2025-05-22 09:45:33 +02:00
parent 77abf68e3c
commit fb3a4a0d19

View file

@ -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}}}|<I>{ty}</I>|<B>{description}</B>}}>"##
));
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(", ")
}