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

ConsistentColors: Adjust for background

parent 1f626f51
......@@ -36,8 +36,6 @@
from gi.repository import GLib
from gi.repository import Gdk
from nbxmpp.util import text_to_colour
from gajim.common import app
from gajim.common import helpers
from gajim.common import i18n
......@@ -50,6 +48,7 @@
from gajim.gtk.util import load_icon
from gajim.gtk.util import get_cursor
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 is_emoji
from gajim.gtk.emoji_data import get_emoji_pixbuf
......@@ -1254,7 +1253,7 @@ def print_name(self, name, kind, other_tags_for_name, direction_mark='',
def _add_new_colour_tags(self, tag, name):
if self._buffer.get_tag_table().lookup(tag) is not None:
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)
def print_subject(self, subject, iter_=None):
......
......@@ -32,6 +32,7 @@
from gi.repository import Gtk
from gi.repository import GLib
from gi.repository import Pango
import nbxmpp
import cairo
from gajim.common import app
......@@ -641,3 +642,11 @@ def do_get_preferred_width(self):
if minimum_width > self._max_width:
minimum_width = self._max_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