diff --git a/client/css/style.css b/client/css/style.css index cd071a0c..e80877a3 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -746,12 +746,45 @@ button, color: #50a656; } -#chat.no-colors .from .user, -#chat.no-colors .text .user, -#chat.no-colors .sidebar .user { - color: #50a656 !important; +/* Nicknames */ + +#chat .user { + color: #50a656; } +#chat.colored-nicks .user.color-1 { color: #1396cf; } +#chat.colored-nicks .user.color-2 { color: #ffcf89; } +#chat.colored-nicks .user.color-3 { color: #00dc5f; } +#chat.colored-nicks .user.color-4 { color: #ff5bc8; } +#chat.colored-nicks .user.color-5 { color: #ff0e1b; } +#chat.colored-nicks .user.color-6 { color: #000094; } +#chat.colored-nicks .user.color-7 { color: #006441; } +#chat.colored-nicks .user.color-8 { color: #00566e; } +#chat.colored-nicks .user.color-9 { color: #ff0078; } +#chat.colored-nicks .user.color-10 { color: #15d5a3; } +#chat.colored-nicks .user.color-11 { color: #006b3b; } +#chat.colored-nicks .user.color-12 { color: #00c5ba; } +#chat.colored-nicks .user.color-13 { color: #00465b; } +#chat.colored-nicks .user.color-14 { color: #ffafce; } +#chat.colored-nicks .user.color-15 { color: #ff3b12; } +#chat.colored-nicks .user.color-16 { color: #16cc6a; } +#chat.colored-nicks .user.color-17 { color: #ff0072; } +#chat.colored-nicks .user.color-18 { color: #ff5877; } +#chat.colored-nicks .user.color-19 { color: #ff1753; } +#chat.colored-nicks .user.color-20 { color: #007a56; } +#chat.colored-nicks .user.color-21 { color: #095092; } +#chat.colored-nicks .user.color-22 { color: #000bde; } +#chat.colored-nicks .user.color-23 { color: #00bca9; } +#chat.colored-nicks .user.color-24 { color: #00367d; } +#chat.colored-nicks .user.color-25 { color: #009ec4; } +#chat.colored-nicks .user.color-26 { color: #006119; } +#chat.colored-nicks .user.color-27 { color: #008bb8; } +#chat.colored-nicks .user.color-28 { color: #469c00; } +#chat.colored-nicks .user.color-29 { color: #ff0f95; } +#chat.colored-nicks .user.color-30 { color: #ff7615; } +#chat.colored-nicks .user.color-31 { color: #ff4846; } +#chat.colored-nicks .user.color-32 { color: #ff199b; } + #chat .text { padding-left: 10px; padding-right: 6px; diff --git a/client/index.html b/client/index.html index 44fca1c2..056189a4 100644 --- a/client/index.html +++ b/client/index.html @@ -41,7 +41,7 @@
-
+
@@ -211,7 +211,7 @@
diff --git a/client/js/libs/handlebars/colorClass.js b/client/js/libs/handlebars/colorClass.js new file mode 100644 index 00000000..bd371910 --- /dev/null +++ b/client/js/libs/handlebars/colorClass.js @@ -0,0 +1,13 @@ +"use strict"; + +Handlebars.registerHelper( + // Generates a string from "color-1" to "color-32" based on an input string + "colorClass", function(str) { + var hash = 0; + for (var i = 0; i < str.length; i++) { + hash += str.charCodeAt(i); + } + + return "color-" + (1 + hash % 32); + } +); diff --git a/client/js/libs/handlebars/stringcolor.js b/client/js/libs/handlebars/stringcolor.js deleted file mode 100644 index 0a91a781..00000000 --- a/client/js/libs/handlebars/stringcolor.js +++ /dev/null @@ -1,5 +0,0 @@ -Handlebars.registerHelper( - "stringcolor", function(str) { - return window.stringcolor(str); - } -); diff --git a/client/js/libs/stringcolor.js b/client/js/libs/stringcolor.js deleted file mode 100644 index 4db91183..00000000 --- a/client/js/libs/stringcolor.js +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * stringcolor - * Generate a consistent color from any string. - * - * Source: - * https://github.com/erming/stringcolor - * - * Version 0.2.0 - */ -(function($) { - /** - * Generate hex color code from a string. - * - * @param {String} string - */ - $.stringcolor = function(string) { - return "#" + stringcolor(string); - }; - - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param {String|Array} property - * @param {String} string - */ - $.fn.stringcolor = function(property, string) { - if (!property || !string) { - throw new Error("$(selector).string_to_color() takes 2 arguments"); - } - return this.each(function() { - var props = [].concat(property); - var $this = $(this); - $.map(props, function(p) { - $this.css(p, $.stringcolor(string)); - }); - }); - }; -})(jQuery); - -/*! - * Name: string_to_color - * Author: Brandon Corbin [code@icorbin.com] - * Website: http://icorbin.com - */ -function string_to_color(str) { - // Generate a Hash for the String - var hash = function(word) { - var h = 0; - for (var i = 0; i < word.length; i++) { - h = word.charCodeAt(i) + ((h << 5) - h); - } - return h; - }; - - // Change the darkness or lightness - var shade = function(color, prc) { - var num = parseInt(color, 16), - amt = Math.round(2.55 * prc), - R = (num >> 16) + amt, - G = (num >> 8 & 0x00FF) + amt, - B = (num & 0x0000FF) + amt; - return (0x1000000 + (R < 255 ? R < 1 ? 0 : R : 255) * 0x10000 + - (G < 255 ? G < 1 ? 0 : G : 255) * 0x100 + - (B < 255 ? B < 1 ? 0 : B : 255)) - .toString(16) - .slice(1); - }; - - // Convert init to an RGBA - var int_to_rgba = function(i) { - var color = ((i >> 24) & 0xFF).toString(16) + - ((i >> 16) & 0xFF).toString(16) + - ((i >> 8) & 0xFF).toString(16) + - (i & 0xFF).toString(16); - return color; - }; - - return shade( - int_to_rgba(hash(str)), - -10 - ); -} - -var cache = {}; -function stringcolor(str) { - return cache[str] = cache[str] || string_to_color(str); -} diff --git a/client/js/lounge.js b/client/js/lounge.js index 41dd41a2..475cc008 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -437,7 +437,7 @@ $(function() { var settings = $("#settings"); var options = $.extend({ desktopNotifications: false, - colors: false, + coloredNicks: true, join: true, links: true, mode: true, @@ -487,8 +487,8 @@ $(function() { ].indexOf(name) !== -1) { chat.toggleClass("hide-" + name, !self.prop("checked")); } - if (name === "colors") { - chat.toggleClass("no-colors", !self.prop("checked")); + if (name === "coloredNicks") { + chat.toggleClass("colored-nicks", self.prop("checked")); } if (name === "userStyles") { $(document.head).find("#user-specified-css").html(options[name]); diff --git a/client/themes/crypto.css b/client/themes/crypto.css index 02716e1a..e1a57b0f 100644 --- a/client/themes/crypto.css +++ b/client/themes/crypto.css @@ -112,10 +112,8 @@ a:hover, top: 48px; } -#chat.no-colors .from .user, -#chat.no-colors .text .user, -#chat.no-colors .sidebar .user { - color: #000 !important; +#chat .user { + color: black; font-weight: bold; } diff --git a/client/themes/morning.css b/client/themes/morning.css index 4cf15e70..c43fa485 100644 --- a/client/themes/morning.css +++ b/client/themes/morning.css @@ -92,18 +92,47 @@ QUIT #d0907d } /* Nicknames */ -#chat.no-colors .from .user, -#chat.no-colors .text .user, -#chat.no-colors .sidebar .user { - color: #b0bacf !important; +#chat .user { + color: #b0bacf; } -#chat.no-colors .from .user:hover, -#chat.no-colors .text .user:hover, -#chat.no-colors .sidebar .user:hover { - color: #fefefe !important; +#chat .user:hover { + color: #fefefe; } +#chat.colored-nicks .user.color-1 { color: #f7adf7; } +#chat.colored-nicks .user.color-2 { color: #abf99f; } +#chat.colored-nicks .user.color-3 { color: #86efdc; } +#chat.colored-nicks .user.color-4 { color: #b76ee5; } +#chat.colored-nicks .user.color-5 { color: #f9a4b3; } +#chat.colored-nicks .user.color-6 { color: #f7999a; } +#chat.colored-nicks .user.color-7 { color: #f497b9; } +#chat.colored-nicks .user.color-8 { color: #f9a9d7; } +#chat.colored-nicks .user.color-9 { color: #7fa2e2; } +#chat.colored-nicks .user.color-10 { color: #a8b8ff; } +#chat.colored-nicks .user.color-11 { color: #ad88fc; } +#chat.colored-nicks .user.color-12 { color: #f4aead; } +#chat.colored-nicks .user.color-13 { color: #fc71ab; } +#chat.colored-nicks .user.color-14 { color: #ff72e0; } +#chat.colored-nicks .user.color-15 { color: #8cb6ea; } +#chat.colored-nicks .user.color-16 { color: #f9857c; } +#chat.colored-nicks .user.color-17 { color: #ed9b82; } +#chat.colored-nicks .user.color-18 { color: #8df484; } +#chat.colored-nicks .user.color-19 { color: #ffcce3; } +#chat.colored-nicks .user.color-20 { color: #efcc81; } +#chat.colored-nicks .user.color-21 { color: #90a1ed; } +#chat.colored-nicks .user.color-22 { color: #f4d484; } +#chat.colored-nicks .user.color-23 { color: #97ea70; } +#chat.colored-nicks .user.color-24 { color: #fcbbba; } +#chat.colored-nicks .user.color-25 { color: #eef975; } +#chat.colored-nicks .user.color-26 { color: #c7ff93; } +#chat.colored-nicks .user.color-27 { color: #ffade1; } +#chat.colored-nicks .user.color-28 { color: #98ecf2; } +#chat.colored-nicks .user.color-29 { color: #7187f2; } +#chat.colored-nicks .user.color-30 { color: #9676e2; } +#chat.colored-nicks .user.color-31 { color: #f2a4eb; } +#chat.colored-nicks .user.color-32 { color: #85f27d; } + #chat a { color: #428bca; } diff --git a/client/themes/zenburn.css b/client/themes/zenburn.css index e92187f9..2ba7da14 100644 --- a/client/themes/zenburn.css +++ b/client/themes/zenburn.css @@ -122,18 +122,47 @@ body { } /* Nicknames */ -#chat.no-colors .from .user, -#chat.no-colors .text .user, -#chat.no-colors .sidebar .user { - color: #bc8cbc !important; +#chat .user { + color: #bc8cbc; } -#chat.no-colors .from .user:hover, -#chat.no-colors .text .user:hover, -#chat.no-colors .sidebar .user:hover { - color: #dcdccc !important; +#chat .user:hover { + color: #dcdccc; } +#chat.colored-nicks .user.color-1 { color: #f7adf7; } +#chat.colored-nicks .user.color-2 { color: #abf99f; } +#chat.colored-nicks .user.color-3 { color: #86efdc; } +#chat.colored-nicks .user.color-4 { color: #b76ee5; } +#chat.colored-nicks .user.color-5 { color: #f9a4b3; } +#chat.colored-nicks .user.color-6 { color: #f7999a; } +#chat.colored-nicks .user.color-7 { color: #f497b9; } +#chat.colored-nicks .user.color-8 { color: #f9a9d7; } +#chat.colored-nicks .user.color-9 { color: #7fa2e2; } +#chat.colored-nicks .user.color-10 { color: #a8b8ff; } +#chat.colored-nicks .user.color-11 { color: #ad88fc; } +#chat.colored-nicks .user.color-12 { color: #f4aead; } +#chat.colored-nicks .user.color-13 { color: #fc71ab; } +#chat.colored-nicks .user.color-14 { color: #ff72e0; } +#chat.colored-nicks .user.color-15 { color: #8cb6ea; } +#chat.colored-nicks .user.color-16 { color: #f9857c; } +#chat.colored-nicks .user.color-17 { color: #ed9b82; } +#chat.colored-nicks .user.color-18 { color: #8df484; } +#chat.colored-nicks .user.color-19 { color: #ffcce3; } +#chat.colored-nicks .user.color-20 { color: #efcc81; } +#chat.colored-nicks .user.color-21 { color: #90a1ed; } +#chat.colored-nicks .user.color-22 { color: #f4d484; } +#chat.colored-nicks .user.color-23 { color: #97ea70; } +#chat.colored-nicks .user.color-24 { color: #fcbbba; } +#chat.colored-nicks .user.color-25 { color: #eef975; } +#chat.colored-nicks .user.color-26 { color: #c7ff93; } +#chat.colored-nicks .user.color-27 { color: #ffade1; } +#chat.colored-nicks .user.color-28 { color: #98ecf2; } +#chat.colored-nicks .user.color-29 { color: #7187f2; } +#chat.colored-nicks .user.color-30 { color: #9676e2; } +#chat.colored-nicks .user.color-31 { color: #f2a4eb; } +#chat.colored-nicks .user.color-32 { color: #85f27d; } + #chat a { color: #8c8cbc; } diff --git a/client/views/actions/action.tpl b/client/views/actions/action.tpl index f840a9ce..fa5eefb8 100644 --- a/client/views/actions/action.tpl +++ b/client/views/actions/action.tpl @@ -1,2 +1,2 @@ -{{mode}}{{from}} +{{mode}}{{from}} {{{parse text}}} diff --git a/client/views/actions/ctcp.tpl b/client/views/actions/ctcp.tpl index 444ffdef..9f02f804 100644 --- a/client/views/actions/ctcp.tpl +++ b/client/views/actions/ctcp.tpl @@ -1,2 +1,2 @@ -{{from}} +{{from}} {{ctcpType}} {{{parse ctcpMessage}}} diff --git a/client/views/actions/invite.tpl b/client/views/actions/invite.tpl index 74098399..4f710e82 100644 --- a/client/views/actions/invite.tpl +++ b/client/views/actions/invite.tpl @@ -1,9 +1,9 @@ -{{from}} +{{from}} invited {{#if invitedYou}} you {{else}} - {{invited}} + {{invited}} {{/if}} to {{{parse channel}}} diff --git a/client/views/actions/join.tpl b/client/views/actions/join.tpl index 5e3f48c3..265c361b 100644 --- a/client/views/actions/join.tpl +++ b/client/views/actions/join.tpl @@ -1,3 +1,3 @@ -{{mode}}{{from}} +{{mode}}{{from}} ({{hostmask}}) has joined the channel diff --git a/client/views/actions/kick.tpl b/client/views/actions/kick.tpl index 8dc44a29..e50aae12 100644 --- a/client/views/actions/kick.tpl +++ b/client/views/actions/kick.tpl @@ -1,6 +1,6 @@ -{{mode}}{{from}} +{{mode}}{{from}} has kicked -{{target}} +{{target}} {{#if text}} ({{{parse text}}}) {{/if}} diff --git a/client/views/actions/mode.tpl b/client/views/actions/mode.tpl index c162ac2a..28887c9b 100644 --- a/client/views/actions/mode.tpl +++ b/client/views/actions/mode.tpl @@ -1,3 +1,3 @@ -{{mode}}{{from}} +{{mode}}{{from}} sets mode {{{parse text}}} diff --git a/client/views/actions/nick.tpl b/client/views/actions/nick.tpl index dc168ffa..59f26e3a 100644 --- a/client/views/actions/nick.tpl +++ b/client/views/actions/nick.tpl @@ -1,3 +1,3 @@ -{{mode}}{{nick}} +{{mode}}{{nick}} is now known as -{{mode}}{{new_nick}} +{{mode}}{{new_nick}} diff --git a/client/views/actions/part.tpl b/client/views/actions/part.tpl index 36415248..157dcb4f 100644 --- a/client/views/actions/part.tpl +++ b/client/views/actions/part.tpl @@ -1,4 +1,4 @@ -{{mode}}{{from}} +{{mode}}{{from}} ({{hostmask}}) has left the channel {{#if text}} diff --git a/client/views/actions/quit.tpl b/client/views/actions/quit.tpl index a373f659..7249d1f6 100644 --- a/client/views/actions/quit.tpl +++ b/client/views/actions/quit.tpl @@ -1,4 +1,4 @@ -{{mode}}{{from}} +{{mode}}{{from}} ({{hostmask}}) has quit {{#if text}} diff --git a/client/views/actions/topic.tpl b/client/views/actions/topic.tpl index d79e3eb8..4aac391c 100644 --- a/client/views/actions/topic.tpl +++ b/client/views/actions/topic.tpl @@ -1,5 +1,5 @@ {{#if from}} - {{mode}}{{from}} + {{mode}}{{from}} has changed the topic to: {{else}} The topic is: diff --git a/client/views/actions/topic_set_by.tpl b/client/views/actions/topic_set_by.tpl index 9a31e293..516dce9e 100644 --- a/client/views/actions/topic_set_by.tpl +++ b/client/views/actions/topic_set_by.tpl @@ -1,3 +1,3 @@ Topic set by -{{mode}}{{nick}} +{{mode}}{{nick}} on {{localeDate when}} diff --git a/client/views/actions/whois.tpl b/client/views/actions/whois.tpl index 7f8f5112..40fe4cd8 100644 --- a/client/views/actions/whois.tpl +++ b/client/views/actions/whois.tpl @@ -1,35 +1,35 @@
- {{whois.nick}} + {{whois.nick}} ({{whois.user}}@{{whois.host}}): {{whois.real_name}}
{{#if whois.account}}
- {{whois.nick}} + {{whois.nick}} is logged in as {{whois.account}}
{{/if}} {{#if whois.channels}}
- {{whois.nick}} + {{whois.nick}} is on the following channels: {{{parse whois.channels}}}
{{/if}} {{#if whois.server}}
- {{whois.nick}} + {{whois.nick}} is connected to {{whois.server}} ({{whois.server_info}})
{{/if}} {{#if whois.secure}}
- {{whois.nick}} + {{whois.nick}} is using a secure connection
{{/if}} {{#if whois.away}}
- {{whois.nick}} + {{whois.nick}} is away ({{whois.away}})
{{/if}} diff --git a/client/views/msg.tpl b/client/views/msg.tpl index e605bd95..32bed856 100644 --- a/client/views/msg.tpl +++ b/client/views/msg.tpl @@ -4,7 +4,7 @@ {{#if from}} - {{mode}}{{from}} + {{mode}}{{from}} {{/if}} {{#equal type "toggle"}} diff --git a/client/views/user.tpl b/client/views/user.tpl index a96dd288..666fbd5e 100644 --- a/client/views/user.tpl +++ b/client/views/user.tpl @@ -13,7 +13,7 @@ {{/unless}}
{{/diff}} - + {{/each}}