@@ -6,17 +6,22 @@ import kleur from "kleur"
66import colors from "colors"
77import picocolors from "picocolors"
88import ansicolors from "ansi-colors"
9+ import { styleText } from "node:util"
910
1011const test = ( c ) =>
1112 c . red ( `${ c . bold ( `${ c . cyan ( `${ c . yellow ( "yellow" ) } cyan` ) } ` ) } red` )
1213
14+ const testNode = ( ) =>
15+ styleText ( "red" , `${ styleText ( [ "bold" , "cyan" ] , `${ styleText ( "yellow" , "yellow" ) } cyan` ) } red` )
16+
1317new bench . Suite ( )
14- . add ( " chalk " , ( ) => test ( chalk ) )
15- . add ( " kleur " , ( ) => test ( kleur ) )
16- . add ( " colors " , ( ) => test ( colors ) )
17- . add ( " ansi-colors " , ( ) => test ( ansicolors ) )
18- . add ( " picocolors " , ( ) => test ( picocolors ) )
19- . add ( "+ colorette " , ( ) => test ( colorette ) )
18+ . add ( " chalk " , ( ) => test ( chalk ) )
19+ . add ( " kleur " , ( ) => test ( kleur ) )
20+ . add ( " colors " , ( ) => test ( colors ) )
21+ . add ( " ansi-colors " , ( ) => test ( ansicolors ) )
22+ . add ( " picocolors " , ( ) => test ( picocolors ) )
23+ . add ( " node:util.styleText " , ( ) => testNode ( ) )
24+ . add ( "+ colorette " , ( ) => test ( colorette ) )
2025 . on ( "cycle" , ( { target : { name, hz } } ) =>
2126 console . log ( name , `${ Math . floor ( hz ) . toLocaleString ( ) } ops/sec` . padStart ( 18 ) )
2227 )
0 commit comments