File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ var supportsColor = require('supports-color');
66const chalk = {
77 enabled : supportsColor . stdout ,
88 use256 : supportsColor . stdout && supportsColor . stdout . has256 ,
9+ use16m : supportsColor . stdout && supportsColor . stdout . has16m ,
910 themes : new Map ( ) ,
1011 theme : { }
1112} ;
@@ -30,7 +31,9 @@ chalk.setTheme = function(name) {
3031} ;
3132
3233chalk . sprint = function ( s , hex ) {
33- const color = chalk . use256 ? style . color . ansi256 . hex ( hex ) : style . color . ansi . hex ( hex ) ;
34+ const color = chalk . use16m ? style . color . ansi16m . hex ( hex )
35+ : chalk . use256 ? style . color . ansi256 . hex ( hex )
36+ : style . color . ansi . hex ( hex ) ;
3437 return color + s + style . color . close ;
3538} ;
3639
@@ -60,7 +63,10 @@ chalk.init = function() {
6063 const v = x [ 1 ] ;
6164 const bgK = bgName ( k ) ;
6265
63- if ( chalk . use256 ) {
66+ if ( chalk . use16m ) {
67+ theme [ k ] = style . color . ansi16m . hex ( v ) ;
68+ theme [ bgK ] = style . bgColor . ansi16m . hex ( v ) ;
69+ } else if ( chalk . use256 ) {
6470 theme [ k ] = style . color . ansi256 . hex ( v ) ;
6571 theme [ bgK ] = style . bgColor . ansi256 . hex ( v ) ;
6672 } else {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ describe('chalk', function() {
1010 chalk = rewire ( '../lib/chalk' ) ;
1111 chalk . enabled = true ;
1212 chalk . use256 = true ;
13+ chalk . use16m = false ;
1314 } ) ;
1415
1516 it ( 'should ok w/ 256 colors' , function ( ) {
You can’t perform that action at this time.
0 commit comments