Open In App
Related Articles

How to configure node.js console font ?

Improve Article
Save Article
Like Article

You can format the console font in Node.js using the CHALK module. The chalk module is can be used to customize node console. By using it, one can change the console look using features of it like bold the text, making underlines, highlighting the background color of a text, etc. 

Features of Chalk module:

  • It’s easy to get started and easy to use.
  • It is a widely used and popular module for formatting text.
  • Users can format the console text very easily.

Installing the Chalk module and using It:

You can visit the link Install Chalk module to install this package using the command.

$ npm install --save chalk

After installing the chalk module you can check your chalk version on the command prompt by using the following command.

npm version chalk

After that, you can just create a folder and add a file for example app.js. To run this file you need to execute the command.

$ node app.js

Requiring module: You need to include the chalk module in your file using these lines.

var chalk = require('chalk');

Project Structure:

project structure

Filename: app.js 


// Include chalk module
const chalk = require('chalk')
// Set background color to yellow
console.log('Greetings from Geekforgeeks'));
// Set background color to blue
console.log('Greetings from Geekforgeeks'));
// Modifiers can also be applied
console.log('Greetings from Geekforgeeks'));

Steps to run the program:

Run the app.js file using the following commands:

node app.js

Output of above command

Last Updated : 20 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials