3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Node.js: kolorist でConsole.log に色を付ける

Posted at

10 Trending projects on GitHub for web developers - 9th April 2021 にて紹介されていたものをお試しした記録。

導入

npm install --save-dev kolorist

お試し

kolorist_test.js
import { red, cyan, blue, yellow, white, magenta, green, bgYellow, bgWhite, bold } from 'kolorist';

console.log(red(`Error: カラリストで色付きエラー ${cyan('kolorist_test.js')}.`));

console.log(blue('あお'));

console.log(magenta('マゼンタ'));

console.log(yellow('イエロー'));

console.log(green(bold('グリーン')));

console.log(bgYellow(white('背景イエロー')));

console.log(bgWhite(red('背景白')));



node kolorist_test.mjs でお試し。

出力結果

image.png

余談

本論と全く関係ないが mjs というものは何なのかは以下。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?