From ee4e0c19ae5b87f8ec8c88caa14c2ddf15303ead Mon Sep 17 00:00:00 2001 From: Anant Thazhemadam Date: Mon, 11 Oct 2021 19:02:30 +0530 Subject: [PATCH] change colors to blue-magenta instead of red-green combo 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. --- src/ui.jl | 4 ++-- test/terminal.jl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ui.jl b/src/ui.jl index c7072706..d5f1a1b6 100644 --- a/src/ui.jl +++ b/src/ui.jl @@ -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 @@ -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, [", diff --git a/test/terminal.jl b/test/terminal.jl index 1ed5b7e7..1b90f7f7 100644 --- a/test/terminal.jl +++ b/test/terminal.jl @@ -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 @@ -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]) @@ -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')