Skip to content

Commit

Permalink
change colors to blue-magenta instead of red-green combo
Browse files Browse the repository at this point in the history
Since red-green color blindness is common, use a blue-magenta combo
instead. Also, make the toggled option bold and change the color of
first line of the menu to green to reduce the amount of blue in the
menu.
  • Loading branch information
thazhemadam committed Mar 15, 2023
1 parent 897952f commit ef2c459
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ui.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const debugcolors = (:nothing, :light_black, :yellow)
function usage(@nospecialize(view_cmd), annotate_source, optimize, iswarn, hide_type_stable, debuginfo, remarks, with_effects, inline_cost, type_annotations, highlight,
custom_toggles::Vector{CustomToggle})
colorize(active_option::Bool, c::Char) = stringify() do io
active_option ? printstyled(io, c; color=:green) : printstyled(io, c; color=:red)
active_option ? printstyled(io, c; color=:blue) : printstyled(io, c; color=:magenta)
end

colorize(s::AbstractString; color::Symbol = :cyan) = stringify() do io
Expand All @@ -105,7 +105,7 @@ function usage(@nospecialize(view_cmd), annotate_source, optimize, iswarn, hide_
ioctx = IOContext(io, :color=>true)

println(ioctx,
colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color=:blue))
colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color=:green))
print(ioctx,
colorize("Toggles"), ": [",
colorize(iswarn, 'w'), "]arn, [",
Expand Down
8 changes: 4 additions & 4 deletions test/test_terminal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end
@test Cthulhu.default_terminal() isa REPL.Terminals.TTYTerminal
end
colorize(active_option::Bool, c::Char) = Cthulhu.stringify() do io
active_option ? printstyled(io, c; color=:green) : printstyled(io, c; color=:red)
active_option ? printstyled(io, c; bold=true, color=:blue) : printstyled(io, c; color=:magenta)
end

colorize(s::AbstractString; color::Symbol = :cyan) = Cthulhu.stringify() do io
Expand Down Expand Up @@ -80,14 +80,14 @@ end
@test occursin('[' * colorize(true, 'o') * "]ptimize", lines)
@test occursin('[' * colorize(true, 'T') * "]yped", lines)

@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :green), lines) # beginning of the line
@test occursin('', lines)
write(in, 'o') # switch to unoptimized
lines = cread(out)
@test occursin("invoke simplef(::Float32,::Int32)::Float32", lines)
@test occursin(r"\(z = a \* a\)\u001B\[\d\dm::Float32\u001B\[39m", lines)
@test occursin('[' * colorize(false, 'o') * "]ptimize", lines)
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :green), lines) # beginning of the line
@test occursin("• %1 = *(::Float32,::Float32)::Float32", lines)
# Call selection
write(in, keydict[:down])
Expand Down Expand Up @@ -119,7 +119,7 @@ end
@test occursin(r"z.*::Float32", lines)
@test occursin(r"\nBody.*Float32", lines)
@test occursin('[' * colorize(true, 'w') * "]arn", lines)
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :blue), lines) # beginning of the line
@test occursin('\n' * colorize("Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color = :green), lines) # beginning of the line
@test occursin("• %1 = *(::Float32,::Float32)::Float32", lines)
# Source view
write(in, 'S')
Expand Down

0 comments on commit ef2c459

Please sign in to comment.