From 3144c0663bb77f6c4695132f037bc80c47188912 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 5 Jan 2015 18:44:30 +0100 Subject: [PATCH] Themes can be flagged as 'dark', which makes nick highlighting a bit more legible --- client/assets/themes/cli/theme.json | 5 +++-- client/src/views/channel.js | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/assets/themes/cli/theme.json b/client/assets/themes/cli/theme.json index e70afca..a05c682 100644 --- a/client/assets/themes/cli/theme.json +++ b/client/assets/themes/cli/theme.json @@ -1,4 +1,5 @@ { "name": "CLI", - "thumbnail_colour": "#222" -} \ No newline at end of file + "thumbnail_colour": "#222", + "dark": true +} diff --git a/client/src/views/channel.js b/client/src/views/channel.js index 4275358..6d521d3 100644 --- a/client/src/views/channel.js +++ b/client/src/views/channel.js @@ -244,11 +244,16 @@ _kiwi.view.Channel = _kiwi.view.Panel.extend({ // Sgnerate a css style for a nick getNickStyles: function(nick) { - var ret, colour, nick_int = 0, rgb; + var ret, colour, nick_int = 0, rgb, isDark; // Get a colour from a nick (Method based on IRSSIs nickcolor.pl) _.map(nick.split(''), function (i) { nick_int += i.charCodeAt(0); }); - rgb = hsl2rgb(nick_int % 255, 70, 35); + + isDark = (_.find(_kiwi.app.themes, function (theme) { + return theme.name.toLowerCase() === _kiwi.global.settings.get('theme').toLowerCase(); + }) || {}).dark; + + rgb = hsl2rgb(nick_int % 255, 70, isDark ? 60 : 35); rgb = rgb[2] | (rgb[1] << 8) | (rgb[0] << 16); colour = '#' + rgb.toString(16); -- 2.25.1