"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/ansistyles/ansistyles.js" (8 Mar 2017, 978 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 /*
    4  * Info: http://www.termsys.demon.co.uk/vtansi.htm#colors 
    5  * Following caveats
    6  * bright    - brightens the color (bold-blue is same as brigthtBlue)
    7  * dim       - nothing on Mac or Linux
    8  * italic    - nothing on Mac or Linux
    9  * underline - underlines string
   10  * blink     - nothing on Mac or linux
   11  * inverse   - background becomes foreground and vice versa
   12  *
   13  * In summary, the only styles that work are:
   14  *  - bright, underline and inverse
   15  *  - the others are only included for completeness
   16  */
   17 
   18 var styleNums = {
   19     reset     :  [0, 22]
   20   , bright    :  [1, 22]
   21   , dim       :  [2, 22]
   22   , italic    :  [3, 23]
   23   , underline :  [4, 24]
   24   , blink     :  [5, 25]
   25   , inverse   :  [7, 27]
   26   }
   27   , styles = {}
   28   ;
   29 
   30 Object.keys(styleNums).forEach(function (k) {
   31   styles[k] = function (s) { 
   32     var open = styleNums[k][0]
   33       , close = styleNums[k][1];
   34     return '\u001b[' + open + 'm' + s + '\u001b[' + close + 'm';
   35   };
   36 });
   37 
   38 module.exports = styles;