Commit 5948b62b authored by Martin Pitt's avatar Martin Pitt
Browse files

pygtkcompat: Fix color conversion

gtk_style_context_get_background_color() returns a GdkRGBA value, which has
float values between 0 and 1. However, we construct a GdkColor object from
that, so we need to scale to 0..65535 and round to int.
parent 6af74c50
......@@ -385,9 +385,9 @@ def enable_gtk(version='2.0'):
def __getitem__(self, state):
color = self.context.get_background_color(state)
return Gdk.Color(red=color.red,
green=color.green,
blue=color.blue)
return Gdk.Color(red=int(color.red * 65535),
green=int(color.green * 65535),
blue=int(color.blue *65535))
class Styles(object):
def __init__(self, widget):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment