retro/color_namer — Issue #2: Problem with transformation of rgb
Author: diegorv
Created: 2012-02-07 19:16:37+00:00
State: open

Take a look in my code:

require 'color_namer'
require 'color'
require 'awesome_print'

color = 'ea4c88'
original = Color::RGB.from_html(color)
puts "Original Color(##{color.upcase}): R: #{original.red} - G: #{original.green} - B: #{original.blue}"

cn = ColorNamer.name_from_rgb("#{original.red},#{original.green},#{original.blue}")
ap cn

My output:

Original Color(#EA4C88): R: 234.0 - G: 76.0 - B: 136.0
[
[0] "E75480",
[1] "Dark Pink",
[2] "Red"
]

After ColorName the output color isn`t the same...

Original Color(#EA4C88): R: 234.0 - G: 76.0 - B: 136.0
After ColorNamer: Color(#E75480): R: 231.0 - G: 84.0 - B: 128.0

What`s the problem?!