Commit d009a2cb authored by Philipp Hörist's avatar Philipp Hörist

ConsistentColors: Adjust for background

parent 1f626f51
Pipeline #3582 passed with stages
in 2 minutes and 46 seconds
...@@ -36,8 +36,6 @@ from gi.repository import GObject ...@@ -36,8 +36,6 @@ from gi.repository import GObject
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gdk from gi.repository import Gdk
from nbxmpp.util import text_to_colour
from gajim.common import app from gajim.common import app
from gajim.common import helpers from gajim.common import helpers
from gajim.common import i18n from gajim.common import i18n
...@@ -50,6 +48,7 @@ from gajim.gtk import util ...@@ -50,6 +48,7 @@ from gajim.gtk import util
from gajim.gtk.util import load_icon from gajim.gtk.util import load_icon
from gajim.gtk.util import get_cursor from gajim.gtk.util import get_cursor
from gajim.gtk.util import format_fingerprint from gajim.gtk.util import format_fingerprint
from gajim.gtk.util import text_to_color
from gajim.gtk.emoji_data import emoji_pixbufs from gajim.gtk.emoji_data import emoji_pixbufs
from gajim.gtk.emoji_data import is_emoji from gajim.gtk.emoji_data import is_emoji
from gajim.gtk.emoji_data import get_emoji_pixbuf from gajim.gtk.emoji_data import get_emoji_pixbuf
...@@ -1254,7 +1253,7 @@ class ConversationTextview(GObject.GObject): ...@@ -1254,7 +1253,7 @@ class ConversationTextview(GObject.GObject):
def _add_new_colour_tags(self, tag, name): def _add_new_colour_tags(self, tag, name):
if self._buffer.get_tag_table().lookup(tag) is not None: if self._buffer.get_tag_table().lookup(tag) is not None:
return return
gdk_color = Gdk.Color.from_floats(*text_to_colour(name)) gdk_color = Gdk.Color.from_floats(*text_to_color(name))
self._buffer.create_tag(tag, foreground_gdk=gdk_color) self._buffer.create_tag(tag, foreground_gdk=gdk_color)
def print_subject(self, subject, iter_=None): def print_subject(self, subject, iter_=None):
......
...@@ -32,6 +32,7 @@ from gi.repository import Gdk ...@@ -32,6 +32,7 @@ from gi.repository import Gdk
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Pango from gi.repository import Pango
import nbxmpp
import cairo import cairo
from gajim.common import app from gajim.common import app
...@@ -641,3 +642,11 @@ class MaxWidthComboBoxText(Gtk.ComboBoxText): ...@@ -641,3 +642,11 @@ class MaxWidthComboBoxText(Gtk.ComboBoxText):
if minimum_width > self._max_width: if minimum_width > self._max_width:
minimum_width = self._max_width minimum_width = self._max_width
return minimum_width, natural_width return minimum_width, natural_width
def text_to_color(text):
if app.css_config.prefer_dark:
background = (1, 1, 1)
else:
background = (0, 0, 0)
return nbxmpp.util.text_to_color(text, background)
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