diff --git a/gajim/common/config.py b/gajim/common/config.py index ef03d4100..40f0e2a3d 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -50,7 +50,7 @@ class Option(IntEnum): opt_int = [ 'integer', 0 ] opt_str = [ 'string', 0 ] opt_bool = [ 'boolean', 0 ] -opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ] +opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$' ] opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype'] opt_show_roster_on_startup = ['always', 'never', 'last_state'] opt_treat_incoming_messages = ['', 'chat', 'normal'] diff --git a/gajim/config.py b/gajim/config.py index a51851461..61ad624fd 100644 --- a/gajim/config.py +++ b/gajim/config.py @@ -849,7 +849,7 @@ class PreferencesWindow: def on_preference_widget_color_set(self, widget, text): color = widget.get_color() - color_string = gtkgui_helpers.make_color_string(color) + color_string = color.to_string() app.config.set(text, color_string) self.update_text_tags() @@ -946,8 +946,8 @@ class PreferencesWindow: Set color value in prefs and update the UI """ if state: - color = self.xml.get_object(widget_name).get_color() - color_string = gtkgui_helpers.make_color_string(color) + color = self.xml.get_object(widget_name).get_rgba() + color_string = color.to_string() else: color_string = '' app.config.set(option, color_string) diff --git a/gajim/gajim_themes_window.py b/gajim/gajim_themes_window.py index 040edaf2c..0ea5490a8 100644 --- a/gajim/gajim_themes_window.py +++ b/gajim/gajim_themes_window.py @@ -285,8 +285,8 @@ class GajimThemesWindow: Set color value in prefs and update the UI """ if state: - color = widget.get_color() - color_string = gtkgui_helpers.make_color_string(color) + color = widget.get_rgba() + color_string = color.to_string() else: color_string = '' begin_option = '' diff --git a/gajim/gtkgui_helpers.py b/gajim/gtkgui_helpers.py index 47f0bad86..142895ce6 100644 --- a/gajim/gtkgui_helpers.py +++ b/gajim/gtkgui_helpers.py @@ -541,19 +541,6 @@ def make_gtk_month_python_month(month): def make_python_month_gtk_month(month): return month - 1 -def make_color_string(color): - """ - Create #aabbcc color string from gtk color - """ - col = '#' - for i in ('red', 'green', 'blue'): - h = hex(int(getattr(color, i) / (16*16))) - h = h.split('x')[1] - if len(h) == 1: - h = '0' + h - col += h - return col - def make_pixbuf_grayscale(pixbuf): pixbuf2 = pixbuf.copy() pixbuf.saturate_and_pixelate(pixbuf2, 0.0, False)