Skip to content

Commit

Permalink
Fix color wraparound when number of types exceed the max colors
Browse files Browse the repository at this point in the history
  • Loading branch information
saulshanabrook committed Oct 10, 2023
1 parent ea6dd17 commit 686c89a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl EGraph {
let mut typ_colors = std::collections::HashMap::new();

for (typ, class_to_node) in class_nodes {
let next_color = typ_colors.len() % N_COLORS + INITIAL_COLOR;
let next_color = (typ_colors.len() + INITIAL_COLOR) % N_COLORS;
let color = typ_colors.entry(typ).or_insert(next_color);
stmts.push(stmt!(attr!("fillcolor", color)));
for (class_id, nodes) in class_to_node {
Expand Down

0 comments on commit 686c89a

Please sign in to comment.