Comment 1 for bug 273684

Revision history for this message
Ian McIntosh (ian-mcintosh) wrote : Re: Color is not save properly

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