1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Add a "default" pseudo-colour

This commit is contained in:
Conrad Irwin 2011-10-09 21:41:33 -07:00
parent ccb399a93d
commit 65e6e6a788
3 changed files with 15 additions and 5 deletions

View file

@ -46,7 +46,7 @@ class Pry
index == 0 ? text.bright_green(spec.version.to_s) : text.green(spec.version.to_s) index == 0 ? text.bright_green(spec.version.to_s) : text.green(spec.version.to_s)
end end
output.puts "#{text.white gem} (#{versions.join ', '})" output.puts "#{text.default gem} (#{versions.join ', '})"
end end
end end

View file

@ -50,6 +50,16 @@ class Pry
Pry.color ? "\e[1m#{text}\e[0m" : text.to_s Pry.color ? "\e[1m#{text}\e[0m" : text.to_s
end end
# Returns _text_ in the default foreground colour.
# Use this instead of "black" or "white" when you mean absence of colour.
#
# @param [String, #to_s]
# @return [String] _text_
def default(text)
text.to_s
end
alias_method :bright_default, :bold
# Executes _block_ with _Pry.color_ set to false. # Executes _block_ with _Pry.color_ set to false.
# #
# @param [Proc] # @param [Proc]

View file

@ -212,22 +212,22 @@ class Pry
config.ls ||= OpenStruct.new({ config.ls ||= OpenStruct.new({
:heading_color => :grey, :heading_color => :grey,
:public_method_color => :black, :public_method_color => :default,
:private_method_color => :green, :private_method_color => :green,
:protected_method_color => :yellow, :protected_method_color => :yellow,
:method_missing_color => :bright_red, :method_missing_color => :bright_red,
:local_var_color => :black, :local_var_color => :default,
:pry_var_color => :red, # e.g. _, _pry_, _file_ :pry_var_color => :red, # e.g. _, _pry_, _file_
:instance_var_color => :blue, # e.g. @foo :instance_var_color => :blue, # e.g. @foo
:class_var_color => :bright_blue, # e.g. @@foo :class_var_color => :bright_blue, # e.g. @@foo
:global_var_color => :black, # e.g. $CODERAY_DEBUG, $eventmachine_library :global_var_color => :default, # e.g. $CODERAY_DEBUG, $eventmachine_library
:builtin_global_color => :cyan, # e.g. $stdin, $-w, $PID :builtin_global_color => :cyan, # e.g. $stdin, $-w, $PID
:pseudo_global_color => :cyan, # e.g. $~, $1..$9, $LAST_MATCH_INFO :pseudo_global_color => :cyan, # e.g. $~, $1..$9, $LAST_MATCH_INFO
:constant_color => :black, # e.g. VERSION, ARGF :constant_color => :default, # e.g. VERSION, ARGF
:class_constant_color => :blue, # e.g. Object, Kernel :class_constant_color => :blue, # e.g. Object, Kernel
:exception_constant_color => :magenta, # e.g. Exception, RuntimeError :exception_constant_color => :magenta, # e.g. Exception, RuntimeError