Support weechat colors

This commit is contained in:
David Cormier 2013-10-04 14:19:28 -04:00
parent b409bd5e37
commit 345dc70f7a
3 changed files with 67 additions and 1 deletions

View File

@ -4,6 +4,58 @@ body {
color: white;
}
.color-light-green {
color: chartreuse;
}
.color-27 {
color: deepskyblue;
}
.color-28 {
color: greenyellow;
}
.color-00 {
color: coral;
}
.color-yellow {
color: yellow;
}
.color-dark-red {
color: darkred;
}
.color-dark-green {
color: green;
}
.color-dark-blue {
color: darkblue;
}
.color-dark-gray {
color: gray;
}
.color-gray {
color: lightgray;
}
.color-brown {
color: brown;
}
.color-cyan {
color: cyan;
}
.color-dark-cyan {
color: darkcyan;
}
li.notification {
color: green;
}

View File

@ -49,7 +49,7 @@
</span>
<div ng-repeat="bufferline in activeBuffer.lines">
<span ng-repeat="part in bufferline.message" class="text">
<span ng-repeat="part in bufferline.message" class="text {{ part.fg }}">
{{ part.text }}
</span>

View File

@ -24,6 +24,13 @@ weechat.factory('colors', [function($scope) {
return c;
}
function prepareCss(color) {
/*
* Translates a weechat color string to CSS
*/
return'color-' + color.replace(' ', '-');
}
var prefixes = {
'\x19': function() {
if (part.match(/^F/)) {
@ -95,6 +102,7 @@ weechat.factory('colors', [function($scope) {
setAttrs: setAttrs,
getColor: getColor,
prepareCss: prepareCss,
parse: parse,
parts: ['', 'black', 'dark gray', 'dark red', 'light red', 'dark green', 'light green', 'brown', 'yellow', 'dark blue', 'light blue', 'dark magenta', 'light magenta', 'dark cyan', 'light cyan', 'gray', 'white']
}
@ -198,6 +206,12 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var text = colors.parse(message['objects'][0]['content'][0]['message']);
var buffer = message['objects'][0]['content'][0]['buffer'];
var message = _.union(prefix, text);
message =_.map(message, function(message) {
if ('fg' in message) {
message['fg'] = colors.prepareCss(message['fg']);
}
return message;
});
buffer_line['message'] = message;
if (!_isActiveBuffer(buffer)) {