Support colors in nick list

This commit is contained in:
Philippe Proulx 2013-10-27 04:49:59 -04:00
parent 08fd89284e
commit 0f1bde187a
5 changed files with 62 additions and 23 deletions

View file

@ -192,6 +192,16 @@ input[type=text], input[type=password], .badge {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#nicklist li,
#nicklist a {
display: block;
}
#nicklist a {
text-decoration: none;
}
#nicklist a:hover {
background: #3b3b3b;
}
#connection-infos { #connection-infos {
float: left; float: left;

View file

@ -269,13 +269,13 @@
.cwf-darkgray { .cwf-darkgray {
color: #5d5d5d; color: #5d5d5d;
} }
.cwf-darkred { .cwf-red {
color: #c75646; color: #c75646;
} }
.cwf-lightred { .cwf-lightred {
color: #e09690; color: #e09690;
} }
.cwf-darkgreen { .cwf-green {
color: #8eb33b; color: #8eb33b;
} }
.cwf-lightgreen { .cwf-lightgreen {
@ -287,19 +287,19 @@
.cwf-yellow { .cwf-yellow {
color: #ffe377; color: #ffe377;
} }
.cwf-darkblue { .cwf-blue {
color: #72b3cc; color: #72b3cc;
} }
.cwf-lightblue { .cwf-lightblue {
color: #9cd9f0; color: #9cd9f0;
} }
.cwf-darkmagenta { .cwf-magenta {
color: #c8a0d1; color: #c8a0d1;
} }
.cwf-lightmagenta { .cwf-lightmagenta {
color: #fbb1f9; color: #fbb1f9;
} }
.cwf-darkcyan { .cwf-cyan {
color: #218693; color: #218693;
} }
.cwf-lightcyan { .cwf-lightcyan {
@ -322,13 +322,13 @@
.cwb-darkgray { .cwb-darkgray {
background-color: #5d5d5d; background-color: #5d5d5d;
} }
.cwb-darkred { .cwb-red {
background-color: #c75646; background-color: #c75646;
} }
.cwb-lightred { .cwb-lightred {
background-color: #e09690; background-color: #e09690;
} }
.cwb-darkgreen { .cwb-green {
background-color: #8eb33b; background-color: #8eb33b;
} }
.cwb-lightgreen { .cwb-lightgreen {
@ -340,19 +340,19 @@
.cwb-yellow { .cwb-yellow {
background-color: #ffe377; background-color: #ffe377;
} }
.cwb-darkblue { .cwb-blue {
background-color: #72b3cc; background-color: #72b3cc;
} }
.cwb-lightblue { .cwb-lightblue {
background-color: #9cd9f0; background-color: #9cd9f0;
} }
.cwb-darkmagenta { .cwb-magenta {
background-color: #c8a0d1; background-color: #c8a0d1;
} }
.cwb-lightmagenta { .cwb-lightmagenta {
background-color: #fbb1f9; background-color: #fbb1f9;
} }
.cwb-darkcyan { .cwb-cyan {
background-color: #218693; background-color: #218693;
} }
.cwb-lightcyan { .cwb-lightcyan {

View file

@ -229,7 +229,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
<div id="nicklist" ng-hide="nonicklist" class="vertical-line-left"> <div id="nicklist" ng-hide="nonicklist" class="vertical-line-left">
<ul class="nicklistgroup list-unstyled" ng-repeat="group in activeBuffer().nicklist"> <ul class="nicklistgroup list-unstyled" ng-repeat="group in activeBuffer().nicklist">
<li class="" ng-repeat="nick in group.nicks|orderBy:'nick.name'"> <li class="" ng-repeat="nick in group.nicks|orderBy:'nick.name'">
<a ng-click="nickAction(nick)"><span ng-class="nick.prefix_color">{{nick.prefix}}</span><span ng-class="color">{{nick.name}}</span></a> <a ng-click="nickAction(nick)"><span ng-class="nick.prefixClasses">{{nick.prefix}}</span><span ng-class="nick.nameClasses">{{nick.name}}</span></a>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -169,6 +169,38 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
} }
} }
function nickGetColorClasses(nickMsg, propName) {
if (propName in nickMsg && nickMsg[propName] && nickMsg[propName].length > 0) {
var color = nickMsg[propName];
if (color.match(/^weechat/)) {
// color option
var colorName = color.match(/[a-zA-Z0-9_]+$/)[0];
return [
'cof-' + colorName,
'cob-' + colorName,
'coa-' + colorName
];
} else if (color.match(/^[a-zA-Z]+$/)) {
// WeeChat color name
return [
'cwf-' + color
];
}
}
return [
'cwf-default'
];
}
function nickGetClasses(nickMsg) {
return {
'name': nickGetColorClasses(nickMsg, 'color'),
'prefix': nickGetColorClasses(nickMsg, 'prefix_color')
};
}
/* /*
* Nick class * Nick class
*/ */
@ -176,17 +208,14 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
var prefix = message['prefix']; var prefix = message['prefix'];
var visible = message['visible']; var visible = message['visible'];
var name = message['name']; var name = message['name'];
/* TODO translate color to CSS value */ var colorClasses = nickGetClasses(message);
var prefix_color = message['prefix_color'];
/* TODO translate color to CSS value */
var color = message['color'];
return { return {
prefix: prefix, prefix: prefix,
visible: visible, visible: visible,
name: name, name: name,
prefix_color: prefix_color, prefixClasses: colorClasses.prefix,
color: color nameClasses: colorClasses.name
} }
} }
/* /*

View file

@ -44,17 +44,17 @@
'default', 'default',
'black', 'black',
'darkgray', 'darkgray',
'darkred', 'red',
'lightred', 'lightred',
'darkgreen', 'green',
'lightgreen', 'lightgreen',
'brown', 'brown',
'yellow', 'yellow',
'darkblue', 'blue',
'lightblue', 'lightblue',
'darkmagenta', 'magenta',
'lightmagenta', 'lightmagenta',
'darkcyan', 'cyan',
'lightcyan', 'lightcyan',
'gray', 'gray',
'white' 'white'