Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use colors that are accessible for color blind #153

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions numba_rvsdg/rendering/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def render_region_block(
) -> None:
# render subgraph
with digraph.subgraph(name=f"cluster_{name}") as subg:
color = "blue"
color = "#648FFF"
if regionblock.kind == "branch":
color = "green"
color = "#FFB000"
if regionblock.kind == "tail":
color = "purple"
color = "#785EF0"
if regionblock.kind == "head":
color = "red"
color = "#DC267F"
subg.attr(color=color, label=regionblock.name)
assert regionblock.subregion is not None
for name, block in regionblock.subregion.graph.items():
Expand Down Expand Up @@ -248,13 +248,13 @@ def render_region_block(
) -> None:
# render subgraph
with digraph.subgraph(name=f"cluster_{name}") as subg:
color = "blue"
color = "#648FFF"
if regionblock.kind == "branch":
color = "green"
color = "#FFB000"
if regionblock.kind == "tail":
color = "purple"
color = "#785EF0"
if regionblock.kind == "head":
color = "red"
color = "#DC267F"
label = [regionblock.name, r"\n"]
if regionblock.jump_targets:
label.append(
Expand Down
26 changes: 13 additions & 13 deletions numba_rvsdg/tests/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,67 +30,67 @@

expected_restructured = r"""digraph {
subgraph cluster_head_region_0 {
color=red label="head_region_0\n
color="#DC267F" label="head_region_0\n
jump targets: ('branch_region_0', 'branch_region_1')" shape=rect style=rounded
0 [label="0\n
jump targets: ('branch_region_0', 'branch_region_1')" shape=rect style=rounded]
}
subgraph cluster_branch_region_0 {
color=green label="branch_region_0\n
color="#FFB000" label="branch_region_0\n
jump targets: ('tail_region_0',)" shape=rect style=rounded
synth_asign_block_0 [label="synth_asign_block_0\n\l__scfg_control_var_0__ = 0\l
jump targets: ('tail_region_0',)" shape=rect style=rounded]
}
subgraph cluster_branch_region_1 {
color=green label="branch_region_1\n
color="#FFB000" label="branch_region_1\n
jump targets: ('tail_region_0',)" shape=rect style=rounded
synth_asign_block_1 [label="synth_asign_block_1\n\l__scfg_control_var_0__ = 1\l
jump targets: ('tail_region_0',)" shape=rect style=rounded]
}
subgraph cluster_tail_region_0 {
color=purple label="tail_region_0\n" shape=rect style=rounded
color="#785EF0" label="tail_region_0\n" shape=rect style=rounded
5 [label="5\n" shape=rect style=rounded]
subgraph cluster_loop_region_0 {
color=blue label="loop_region_0\n
color="#648FFF" label="loop_region_0\n
jump targets: ('5',)" shape=rect style=rounded
subgraph cluster_head_region_1 {
color=red label="head_region_1\n
color="#DC267F" label="head_region_1\n
jump targets: ('branch_region_2', 'branch_region_3')" shape=rect style=rounded
synth_head_block_0 [label="synth_head_block_0\n\lvariable: __scfg_control_var_0__\l0 → branch_region_2\l1 → branch_region_3\l
jump targets: ('branch_region_2', 'branch_region_3')" shape=rect style=rounded]
}
subgraph cluster_branch_region_2 {
color=green label="branch_region_2\n
color="#FFB000" label="branch_region_2\n
jump targets: ('tail_region_1',)" shape=rect style=rounded
subgraph cluster_head_region_2 {
color=red label="head_region_2\n
color="#DC267F" label="head_region_2\n
jump targets: ('branch_region_4', 'branch_region_5')" shape=rect style=rounded
1 [label="1\n
jump targets: ('3',)" shape=rect style=rounded]
3 [label="3\n
jump targets: ('branch_region_4', 'branch_region_5')" shape=rect style=rounded]
}
subgraph cluster_branch_region_4 {
color=green label="branch_region_4\n
color="#FFB000" label="branch_region_4\n
jump targets: ('tail_region_2',)" shape=rect style=rounded
synth_asign_block_2 [label="synth_asign_block_2\n\l__scfg_backedge_var_0__ = 0\l__scfg_control_var_0__ = 1\l
jump targets: ('tail_region_2',)" shape=rect style=rounded]
}
subgraph cluster_branch_region_5 {
color=green label="branch_region_5\n
color="#FFB000" label="branch_region_5\n
jump targets: ('tail_region_2',)" shape=rect style=rounded
synth_asign_block_3 [label="synth_asign_block_3\n\l__scfg_backedge_var_0__ = 1\l
jump targets: ('tail_region_2',)" shape=rect style=rounded]
}
subgraph cluster_tail_region_2 {
color=purple label="tail_region_2\n
color="#785EF0" label="tail_region_2\n
jump targets: ('tail_region_1',)" shape=rect style=rounded
synth_tail_block_0 [label="synth_tail_block_0\n
jump targets: ('tail_region_1',)" shape=rect style=rounded]
}
}
subgraph cluster_branch_region_3 {
color=green label="branch_region_3\n
color="#FFB000" label="branch_region_3\n
jump targets: ('tail_region_1',)" shape=rect style=rounded
2 [label="2\n
jump targets: ('4',)" shape=rect style=rounded]
Expand All @@ -100,7 +100,7 @@
jump targets: ('tail_region_1',)" shape=rect style=rounded]
}
subgraph cluster_tail_region_1 {
color=purple label="tail_region_1\n
color="#785EF0" label="tail_region_1\n
jump targets: ('5',)" shape=rect style=rounded
synth_exit_latch_block_0 [label="synth_exit_latch_block_0\n\lvariable: __scfg_backedge_var_0__\l1 → 5\l0 → head_region_1\l
jump targets: ('5',)
Expand Down