[polari/wip/fmuellner/nick-differentiation: 1/2] chatView: Differentiate nicks by underline



commit b7dc39f17eda7305d0ca201835425cd2e6140de4
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Oct 19 03:14:14 2017 +0200

    chatView: Differentiate nicks by underline

 src/chatView.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/src/chatView.js b/src/chatView.js
index b9c5b91..0722f94 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -894,6 +894,17 @@ var ChatView = GObject.registerClass({
         return NICKTAG_PREFIX + Polari.util_get_basenick(nick);
     }
 
+    _getNickTagColor(nick) {
+        let type = GLib.ChecksumType.MD5;
+        let baseNick = Polari.util_get_basenick(nick);
+        let hash = GLib.compute_checksum_for_string(type, baseNick, -1);
+        let rgba = new Gdk.RGBA();
+        rgba.parse('#' + hash.substr(0, 6));
+        rgba.alpha = 0.2;
+
+        return rgba;
+    }
+
     _getNickFromTagName(tagName) {
         if (tagName.startsWith(NICKTAG_PREFIX))
             return tagName.replace(NICKTAG_PREFIX, '');
@@ -1247,6 +1258,9 @@ var ChatView = GObject.registerClass({
                     nickTag = new ButtonTag({ name: nickTagName });
                     nickTag.connect('clicked', Lang.bind(this, this._onNickTagClicked));
 
+                    nickTag.underline = Pango.Underline.SINGLE;
+                    nickTag.underline_rgba = this._getNickTagColor(message.nick);
+
                     let status = this._userTracker.getNickRoomStatus(message.nick, this._room);
                     this._updateNickTag(nickTag, status);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]