Skip to content

Commit 46a4733

Browse files
authored
Merge pull request #2144 from topolarity/rainbow-time
Make `SystemStructure` colorful again 🌈
2 parents 4c20852 + 209e039 commit 46a4733

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/bipartite_graph.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ end
228228

229229
function Base.show(io::IO, l::BipartiteAdjacencyList)
230230
if l.match === true
231-
printstyled(io, "")
231+
printstyled(io, "", color = :cyan)
232232
else
233233
printstyled(io, " ")
234234
end
@@ -242,7 +242,17 @@ function Base.show(io::IO, l::BipartiteAdjacencyList)
242242
match = l.match
243243
isa(match, Bool) && (match = unassigned)
244244
function choose_color(i)
245-
i in l.highligh_u ? :default : :light_black
245+
solvable = i in l.highligh_u
246+
matched = i == match
247+
if !matched && solvable
248+
:default
249+
elseif !matched && !solvable
250+
:light_black
251+
elseif matched && solvable
252+
:light_yellow
253+
elseif matched && !solvable
254+
:yellow
255+
end
246256
end
247257
if !isempty(setdiff(l.highligh_u, l.u))
248258
# Only for debugging, shouldn't happen in practice

src/systems/systemstructure.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,14 @@ function Base.show(io::IO, mime::MIME"text/plain", ms::MatchedSystemStructure)
507507
printstyled(io, "\n\nLegend: ")
508508
printstyled(io, "Solvable")
509509
print(io, " | ")
510+
printstyled(io, "(Solvable + Matched)", color = :light_yellow)
511+
print(io, " | ")
510512
printstyled(io, "Unsolvable", color = :light_black)
511513
print(io, " | ")
512-
printstyled(io, "(Matched)")
514+
printstyled(io, "(Unsolvable + Matched)", color = :yellow)
513515
print(io, " | ")
514-
printstyled(io, " ∫ SelectedState ")
516+
printstyled(io, "", color = :cyan)
517+
printstyled(io, " SelectedState")
515518
end
516519

517520
# TODO: clean up

0 commit comments

Comments
 (0)