diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-02-01 05:32:44 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-02-01 05:32:44 -0300 |
commit | 0eaf9e8c417783995bb43318741a45888ed26591 (patch) | |
tree | a26a2a189b277c22b34ee944e2cdb41b3e1425b0 | |
parent | 52f619231dae6b92fa9de9f81464e54b2ad17872 (diff) | |
download | highline-0eaf9e8c417783995bb43318741a45888ed26591.tar.gz |
Simplify Style#create_bright_variant
-rwxr-xr-x | lib/highline/style.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/highline/style.rb b/lib/highline/style.rb index e6ed17a..3f83527 100755 --- a/lib/highline/style.rb +++ b/lib/highline/style.rb @@ -180,13 +180,9 @@ class HighLine def create_bright_variant(variant_name) raise "Cannot create a #{name} variant of a style list (#{inspect})" if @list new_name = ("#{variant_name}_"+@name.to_s).to_sym + new_rgb = @rgb == [0,0,0] ? [128, 128, 128] : @rgb.map {|color| color==0 ? 0 : [color+128,255].min } - if style = find_style(new_name) - style - else - new_rgb = @rgb == [0,0,0] ? [128, 128, 128] : @rgb.map {|color| color==0 ? 0 : [color+128,255].min } - variant(new_name, :increment=>60, :rgb=>new_rgb) - end + find_style(new_name) or variant(new_name, :increment=>60, :rgb=>new_rgb) end def find_style(name) |