bright and grey color names.

This commit is contained in:
Christopher Jeffrey 2015-05-01 01:23:47 -07:00
parent e2faf2300e
commit 0506f5fea2
3 changed files with 37 additions and 1 deletions

View File

@ -217,10 +217,12 @@ exports.ccolors = (function() {
})();
var colorNames = exports.colorNames = {
// special
default: -1,
normal: -1,
bg: -1,
fg: -1,
// normal
black: 0,
red: 1,
green: 2,
@ -229,6 +231,7 @@ var colorNames = exports.colorNames = {
magenta: 5,
cyan: 6,
white: 7,
// light
lightblack: 8,
lightred: 9,
lightgreen: 10,
@ -236,7 +239,19 @@ var colorNames = exports.colorNames = {
lightblue: 12,
lightmagenta: 13,
lightcyan: 14,
lightwhite: 15
lightwhite: 15,
// bright
brightblack: 8,
brightred: 9,
brightgreen: 10,
brightyellow: 11,
brightblue: 12,
brightmagenta: 13,
brightcyan: 14,
brightwhite: 15,
// alternate spellings
grey: 8,
gray: 8
};
exports.convert = function(color) {

View File

@ -2427,68 +2427,88 @@ Program.prototype._attr = function(param, val) {
// 16-color foreground
case 'light black fg':
case 'bright black fg':
case 'grey fg':
case 'gray fg':
return val === false
? '\x1b[39m'
: '\x1b[90m';
case 'light red fg':
case 'bright red fg':
return val === false
? '\x1b[39m'
: '\x1b[91m';
case 'light green fg':
case 'bright green fg':
return val === false
? '\x1b[39m'
: '\x1b[92m';
case 'light yellow fg':
case 'bright yellow fg':
return val === false
? '\x1b[39m'
: '\x1b[93m';
case 'light blue fg':
case 'bright blue fg':
return val === false
? '\x1b[39m'
: '\x1b[94m';
case 'light magenta fg':
case 'bright magenta fg':
return val === false
? '\x1b[39m'
: '\x1b[95m';
case 'light cyan fg':
case 'bright cyan fg':
return val === false
? '\x1b[39m'
: '\x1b[96m';
case 'light white fg':
case 'bright white fg':
return val === false
? '\x1b[39m'
: '\x1b[97m';
// 16-color background
case 'light black bg':
case 'bright black bg':
case 'grey bg':
case 'gray bg':
return val === false
? '\x1b[49m'
: '\x1b[100m';
case 'light red bg':
case 'bright red bg':
return val === false
? '\x1b[49m'
: '\x1b[101m';
case 'light green bg':
case 'bright green bg':
return val === false
? '\x1b[49m'
: '\x1b[102m';
case 'light yellow bg':
case 'bright yellow bg':
return val === false
? '\x1b[49m'
: '\x1b[103m';
case 'light blue bg':
case 'bright blue bg':
return val === false
? '\x1b[49m'
: '\x1b[104m';
case 'light magenta bg':
case 'bright magenta bg':
return val === false
? '\x1b[49m'
: '\x1b[105m';
case 'light cyan bg':
case 'bright cyan bg':
return val === false
? '\x1b[49m'
: '\x1b[106m';
case 'light white bg':
case 'bright white bg':
return val === false
? '\x1b[49m'
: '\x1b[107m';

View File

@ -9158,6 +9158,7 @@ helpers.generateTags = function(style, text) {
var val = style[key];
if (typeof val === 'string') {
val = val.replace(/^light(?!-)/, 'light-');
val = val.replace(/^bright(?!-)/, 'bright-');
open = '{' + val + '-' + key + '}' + open;
close += '{/' + val + '-' + key + '}';
} else {