Skip to content

Commit

Permalink
All colours should be converted to rgb
Browse files Browse the repository at this point in the history
  • Loading branch information
zeevallin committed Nov 20, 2015
1 parent f4016a8 commit 746a9ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/gradient/grd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ def parse(buffer)

private def convert_to_color(color_data)
case format = color_data["palette"]
when "CMYC" then Color::CMYK.from_percent(*color_data.values_at("Cyn", "Mgnt", "Ylw", "Blck").map(&:round))
when "CMYC" then Color::CMYK.from_percent(*color_data.values_at("Cyn", "Mgnt", "Ylw", "Blck").map(&:round)).to_rgb
when "RGBC" then Color::RGB.new(*color_data.values_at("Rd", "Grn", "Bl").map(&:round))
when "HSBC"
h = color_data.fetch("H")
s = color_data.fetch("Strt") / 100.0
l = color_data.fetch("Brgh") / 100.0
Color::HSL.from_fraction(h, s, l)
Color::HSL.from_fraction(h, s, l).to_rgb
else
raise NotImplementedError.new("The color #{format} is not supported")
end
Expand Down

0 comments on commit 746a9ea

Please sign in to comment.