"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/ansi-styles/index.js" (7 Feb 2017, 1254 Bytes) of archive /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 'use strict';
    2 
    3 function assembleStyles () {
    4     var styles = {
    5         modifiers: {
    6             reset: [0, 0],
    7             bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
    8             dim: [2, 22],
    9             italic: [3, 23],
   10             underline: [4, 24],
   11             inverse: [7, 27],
   12             hidden: [8, 28],
   13             strikethrough: [9, 29]
   14         },
   15         colors: {
   16             black: [30, 39],
   17             red: [31, 39],
   18             green: [32, 39],
   19             yellow: [33, 39],
   20             blue: [34, 39],
   21             magenta: [35, 39],
   22             cyan: [36, 39],
   23             white: [37, 39],
   24             gray: [90, 39]
   25         },
   26         bgColors: {
   27             bgBlack: [40, 49],
   28             bgRed: [41, 49],
   29             bgGreen: [42, 49],
   30             bgYellow: [43, 49],
   31             bgBlue: [44, 49],
   32             bgMagenta: [45, 49],
   33             bgCyan: [46, 49],
   34             bgWhite: [47, 49]
   35         }
   36     };
   37 
   38     // fix humans
   39     styles.colors.grey = styles.colors.gray;
   40 
   41     Object.keys(styles).forEach(function (groupName) {
   42         var group = styles[groupName];
   43 
   44         Object.keys(group).forEach(function (styleName) {
   45             var style = group[styleName];
   46 
   47             styles[styleName] = group[styleName] = {
   48                 open: '\u001b[' + style[0] + 'm',
   49                 close: '\u001b[' + style[1] + 'm'
   50             };
   51         });
   52 
   53         Object.defineProperty(styles, groupName, {
   54             value: group,
   55             enumerable: false
   56         });
   57     });
   58 
   59     return styles;
   60 }
   61 
   62 Object.defineProperty(module, 'exports', {
   63     enumerable: true,
   64     get: assembleStyles
   65 });