From 746a9ea57cf99b6b48639dd8d80dda38c7966fd3 Mon Sep 17 00:00:00 2001 From: Philip Vieira Date: Fri, 20 Nov 2015 02:22:48 +0100 Subject: [PATCH] All colours should be converted to rgb --- lib/gradient/grd.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gradient/grd.rb b/lib/gradient/grd.rb index 8ee4fd9..57b1132 100644 --- a/lib/gradient/grd.rb +++ b/lib/gradient/grd.rb @@ -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