$ cnpm install cfonts
██████╗ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗
██╔════╝ ██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝
██║ █████╗ ██║ ██║ ██╔██╗ ██║ ██║ ███████╗
██║ ██╔══╝ ██║ ██║ ██║╚██╗██║ ██║ ╚════██║ ╔╗╔ ╔═╗ ╔╦╗ ╔═╗ ╦ ╔═╗
╚██████╗ ██║ ╚██████╔╝ ██║ ╚████║ ██║ ███████║ ║║║ ║ ║ ║║ ║╣ ║ ╚═╗
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝ ╝╚╝ ╚═╝ ═╩╝ ╚═╝ ╚╝ ╚═╝


This is a silly little command line tool for sexy ANSI fonts in the console. Give your cli some love.
npm i cfonts -g
yarn global add cfonts
To use it in your shell:
$ cfonts "Hello|World\!"
???? Remember to escape the ! character with \ in the shell
Or use it in your project:
const cfonts = require('cfonts');
cfonts.say('Hello|world!', {
font: 'block', // define the font face
align: 'left', // define text alignment
colors: ['system'], // define all colors
background: 'transparent', // define the background color, you can also use `backgroundColor` here as key
letterSpacing: 1, // define letter spacing
lineHeight: 1, // define the line height
space: true, // define if the output text should have empty lines on top and on the bottom
maxLength: '0', // define how many character can be on one line
gradient: false, // define your two gradient colors
independentGradient: false, // define if you want to recalculate the gradient for each new line
transitionGradient: false, // define if this is a transition between colors directly
rawMode: false, // define if the line breaks should be CRLF (`\r\n`) over the default LF (`\n`)
env: 'node' // define the environment cfonts is being executed in
});
All settings are optional and shown here with their default
You can use cfonts in your project without the direct output to the console:
const cfonts = require('cfonts');
const prettyFont = cfonts.render('Hello|world!', {/* same settings object as above */});
prettyFont.string // the ansi string for sexy console font
prettyFont.array // returns the array for the output
prettyFont.lines // returns the lines used
prettyFont.options // returns the options used
Read more in the root repo.
This package is tested on the below platform and node combinations as part of our CI.
| Platform | Node |
|---|---|
| Linux | v12 |
| Linux | v14 |
| Linux | v16 |
| Linux | v18 |
| Linux | v20 |
| Linux | v22 |
| MacOS | v16 |
| MacOS | v18 |
| MacOS | v20 |
| MacOS | v22 |
| Windows | v12 |
| Windows | v14 |
| Windows | v16 |
| Windows | v18 |
| Windows | v20 |
| Windows | v22 |
The package comes with a bunch of unit tests that aim to cover 100% of the code base. For more details about the code coverage check out coveralls.
npm run test:unit
Since the code base uses JSDocs we use typescript to test the inferred types from those comments. Typescript supports JSDocs and we use it in our test.
npm run test:types
There is also a test suite for font files.
npm run test:fonts
This tool checks:
Run all tests via:
npm run test
To build the repo install dependencies via:
(Since we ship a yarn.lock file please use yarn for development.)
yarn
and run the watch to continuously transpile the code.
yarn watch
Please look at the coding style and work with it, not against it ;)
gray to gradient colorstop and bottom align optionstinyslick, grid and pallet, added double quote to all fontsmaxLength, gradient and lineHeight, added more end-to-end testsansi-styles from direct dependencieschange-case dependency, added UpperCaseFirst with testsshade, added hex color supportcfonts with pure functions, made colors case-insensitivetransparent and system as default background and color option, added backgroundColor as alias for background, upgraded depsbabel-polyfill to babel-plugin-transform-runtime, added files to package.json, added images to docs, fixed dependenciesconsole font, added comma, added font huge, added render method, added candy colorchrome font, fonttestsimpleBlocksimple3dsimple3d and added to grunt testsimple3d fontconsole font3d fontsimple fontsimple fontCopyright (c) Dominik Wilkowski. Licensed under the GNU GPL-3.0-or-later.
Copyright 2013 - present © cnpmjs.org | Home |