Red/green colorblind users would benefit from the ability to configure success/failure colors.
This seems pretty straightforward. Thoughts on naming and interface?
RSpec.configure do |c|
c.failure_color = :red
c.success_color = :green
end
(and appropriate command line equivalents for ~/.rspec
)?
I think we can support Symbols like :red
and :green
, but we should also support ascii color codes. Otherwise, this seems fine to me.
Specified via integers?
RSpec.configuration.success_color = 34 # blue
Good idea.
Cool. I think this could be a fun one to have a new employee work on. It might be a few weeks if that's OK.
This would be invaluable for red/green colorblind people like me. Thanks for starting this!
I'd like to see symbols for common colors, and let people use an integer if they want something more specific.
This is being implemented in #709.
To get color output to Mac's terminal, add a rspec configuration file named '.rspec' to the project's root and put the following single line in there:
--color
@sdondley that's correct, however this issue is about configuring the specific colors that are used, not when color is used.
Fixed by #709.
Is there now a way of setting these options in .rspec
, as alindeman suggested? I tried --failure-color yellow
, but it didn't work. If there is, it seems not to be documented in the help file.
It appears the answer is still no.
Things that don't have explicit CLI options can still be configured from .rspec
; you just have to --require
a ruby file from there, and then configure it in that file. So, for example, if you wanted to globally change the colors on your machine, you could create a file like ~/configure_rspec_colors.rb
:
RSpec.configure do |c|
# Each of these can be one of the ANSI color code integers or one
# of [:black, :white, :red, :green, :yellow, :blue, :magenta, :cyan].
# The values I've assigned here are the defaults so you'll want to change them.
# Color config is available in RSpec 2.13+. Since this file will
# always be loaded by RSpec and you may have projects on earlier
# versions, it's a good idea to only do this on versions that support it.
if c.respond_to?(:default_color=)
c.default_color = :white
c.detail_color = :cyan
c.failure_color = :red
c.fixed_color = :blue
c.pending_color = :yellow
c.success_color = :green
end
end
And then add --require "~/configure_rspec_colors.rb"
to ~/.rspec
. Any time you run rspec on your machine, you'll get the custom colors.
Most helpful comment
Things that don't have explicit CLI options can still be configured from
.rspec
; you just have to--require
a ruby file from there, and then configure it in that file. So, for example, if you wanted to globally change the colors on your machine, you could create a file like~/configure_rspec_colors.rb
:And then add
--require "~/configure_rspec_colors.rb"
to~/.rspec
. Any time you run rspec on your machine, you'll get the custom colors.