From ef2c45990a7f130d4fb9cadfc0cc933b920d90a8 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/test_terminal.jl | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ui.jl b/src/ui.jl index d80f5c62..a2a5efd3 100644 --- a/src/ui.jl +++ b/src/ui.jl @@ -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 @@ -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, [", diff --git a/test/test_terminal.jl b/test/test_terminal.jl index a465c3b0..4f0fcea8 100644 --- a/test/test_terminal.jl +++ b/test/test_terminal.jl @@ -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 @@ -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]) @@ -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')