"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/ansicolors/ansicolors.js" (11 Apr 2017, 1566 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // ColorCodes explained: http://www.termsys.demon.co.uk/vtansi.htm
    2 'use strict';
    3 
    4 var colorNums = {
    5       white         :  37
    6     , black         :  30
    7     , blue          :  34
    8     , cyan          :  36
    9     , green         :  32
   10     , magenta       :  35
   11     , red           :  31
   12     , yellow        :  33
   13     , brightBlack   :  90
   14     , brightRed     :  91
   15     , brightGreen   :  92
   16     , brightYellow  :  93
   17     , brightBlue    :  94
   18     , brightMagenta :  95
   19     , brightCyan    :  96
   20     , brightWhite   :  97
   21     }
   22   , backgroundColorNums = {
   23       bgBlack         :  40
   24     , bgRed           :  41
   25     , bgGreen         :  42
   26     , bgYellow        :  43
   27     , bgBlue          :  44
   28     , bgMagenta       :  45
   29     , bgCyan          :  46
   30     , bgWhite         :  47
   31     , bgBrightBlack   :  100
   32     , bgBrightRed     :  101
   33     , bgBrightGreen   :  102
   34     , bgBrightYellow  :  103
   35     , bgBrightBlue    :  104
   36     , bgBrightMagenta :  105
   37     , bgBrightCyan    :  106
   38     , bgBrightWhite   :  107
   39     } 
   40   , open   =  {}
   41   , close  =  {}
   42   , colors =  {}
   43   ;
   44 
   45 Object.keys(colorNums).forEach(function (k) {
   46   var o =  open[k]  =  '\u001b[' + colorNums[k] + 'm';
   47   var c =  close[k] =  '\u001b[39m';
   48 
   49   colors[k] = function (s) { 
   50     return o + s + c;
   51   };
   52 });
   53 
   54 Object.keys(backgroundColorNums).forEach(function (k) {
   55   var o =  open[k]  =  '\u001b[' + backgroundColorNums[k] + 'm';
   56   var c =  close[k] =  '\u001b[49m';
   57 
   58   colors[k] = function (s) { 
   59     return o + s + c;
   60   };
   61 });
   62 
   63 module.exports =  colors;
   64 colors.open    =  open;
   65 colors.close   =  close;