Skip to content

Commit

Permalink
Adjusts 'monochromatic' for my needs
Browse files Browse the repository at this point in the history
  • Loading branch information
eliduke committed Jan 26, 2018
1 parent acbb19f commit f7aa6ea
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/chroma/harmonies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,22 @@ def monochromatic(options = {})

h, s, v = @color.hsv
modification = 1.0 / size
palette = []

palette = size.times.map do
Color.new(ColorModes::Hsv.new(h, s, v), @color.format).tap do
size.times do
color = Color.new(ColorModes::Hsv.new(h, s, v), @color.format).tap do
v = (v + modification) % 1
end

unless color == @color
palette << color
end
end

palette << @color

if options[:sort] == :desc
palette.reverse!
end

with_reformat(palette, options[:as])
Expand Down

0 comments on commit f7aa6ea

Please sign in to comment.