The problem was incorrectly assuming that color components were 8-bit (as they appear in the color chooser dialog):
class Gdk::Color def to_hex sprintf('#%x%x%x', red, green, blue) end end
Gdk::Color components are in fact 16-bit.
Revision 12 looks like this:
class Gdk::Color def to_hex sprintf('#%02x%02x%02x', red / 257, green / 257, blue / 257) # because 255 * 257 == 65535 end end
The problem was incorrectly assuming that color components were 8-bit (as they appear in the color chooser dialog):
class Gdk::Color '#%x%x% x', red, green, blue)
def to_hex
sprintf(
end
end
Gdk::Color components are in fact 16-bit.
Revision 12 looks like this:
class Gdk::Color '#%02x% 02x%02x' , red / 257, green / 257, blue / 257) # because 255 * 257 == 65535
def to_hex
sprintf(
end
end