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 Oct 11, 2021
1 parent 6471471 commit ee4e0c1
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 @@ -48,7 +48,7 @@ end
const debugcolors = (:nothing, :light_black, :yellow)
function usage(@nospecialize(view_cmd), optimize, iswarn, hide_type_stable, debuginfo, remarks, inline_cost, type_annotations, highlight)
colorize(iotmp, active_option::Bool, c::Char) = stringify(iotmp) 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(iotmp, s::AbstractString; color::Symbol = :cyan) = stringify(iotmp) do io
Expand All @@ -59,7 +59,7 @@ function usage(@nospecialize(view_cmd), optimize, iswarn, hide_type_stable, debu
ioctx = IOContext(io, :color=>true)

println(ioctx,
colorize(iotmp, "Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color=:blue))
colorize(iotmp, "Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark."; color=:green))
println(ioctx,
colorize(iotmp, "Toggles"), ": [",
colorize(iotmp, optimize, 'o'), "]ptimize, [",
Expand Down
8 changes: 4 additions & 4 deletions test/terminal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const keydict = Dict(:up => "\e[A",
@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 @@ -69,14 +69,14 @@ const keydict = Dict(:up => "\e[A",
@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 @@ -108,7 +108,7 @@ const keydict = Dict(:up => "\e[A",
@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 ee4e0c1

Please sign in to comment.