Nightingale Posing Mischievously


    1.2.1 • Public • Published


    Node stdout/console styler, replace the basic console methods and allow for coloured output.


    npm i @squirrel-forge/node-cfx

    Example output

    @squirrel-forge/node-cfx example text output


    Getting and using a default instance.

    const { cfx, ASCIIREF, OutputStyler } = require( '@squirrel-forge/node-cfx' );
    cfx.log( '[ul][fgreen]underlined green text[re]' );

    Default styled output.

    cfx.success( 'success' );
    cfx.error( 'error' );
    cfx.warn( 'warning' ); 'info' );

    Get a styled string:

    const str = cfx.setStyle( '[ul][fgreen]underlined green text[re]' ); // \x1b[4m\x1b[32munderlined green text\x1b[0m

    To enable automatic prefixing with the current timestamp set the prependTime property:

    cfx.prependTime = true;

    To change the timestamp style, use the timestampPrefix and timestampSuffix properties:

    cfx.timestampPrefix = '[fwhite][[re][th]';
    cfx.timestampSuffix = '[re][fwhite]][re] ';

    Setting a custom timestamp format, see time-stamp for details.

    cfx.timestampFormat = 'YYYY-MM-DD HH:mm:ss';

    Styling options

    Control and text style

    Code Control Code Text
    [re] Reset [bo] Bold
    [rv] Reverse [th] Thin
    - - [ul] Underline
    - - [bl] Blink
    - - [hd] Hidden

    Text and background colors

    Text Background Color
    [fblack] [bblack] Black
    [fred] [bred] Red
    [fgreen] [bgreen] Green
    [fyellow] [byellow] Yellow
    [fblue] [bblue] Blue
    [fmagenta] [bmagenta] Magenta
    [fcyan] [bcyan] Cyan
    [fwhite] [bwhite] White

    Overriding default styles

    Default styles and reset. = {
        error : '[bred][fwhite] ',
        warn : '[byellow][fblack] ',
        info : '[bblack][fcyan] ',
        success : '[bgreen][fblack] ',
    this.styleReset = ' [re]';

    Default reset, used when no other reset is passed to the internal _write method, useful when making your own style methods.

    cfx.defaultReset = ' [re]';

    Issues and docs

    If you encounter any issues, please report here.

    Check the sourcecode on github for detailed comments.


    npm i @squirrel-forge/node-cfx

    DownloadsWeekly Downloads






    Unpacked Size

    21.1 kB

    Total Files


    Last publish


    • dasiux