2.1.2 • Published 1 year ago

yoctocolors-cjs v2.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

yoctocolors 🌈

The smallest and fastest command-line coloring package on the internet

Check out Chalk if you want something more mature and comprehensive.

Highlights

  • Tiny
  • Fast
  • Handles nested colors
  • Tree-shakeable
  • No dependencies
  • Actively maintained

Install

npm install yoctocolors

Usage

import colors from 'yoctocolors';

console.log(colors.red('Yo!'));

console.log(colors.blue(`Welcome to the ${colors.green('yoctocolors')} package!`));

You can also import colors as named imports:

import {red, blue, green} from 'yoctocolors';

console.log(red('Yo!'));

console.log(blue(`Welcome to the ${green('yoctocolors')} package!`));

This package supports basic color detection. Colors can be forcefully enabled by setting the FORCE_COLOR environment variable to 1 and can be forcefully disabled by setting NO_COLOR or NODE_DISABLE_COLORS to any value. More info.

Styles

Modifiers

  • reset - Reset the current style.
  • bold - Make the text bold.
  • dim - Make the text have lower opacity.
  • italic - Make the text italic. (Not widely supported)
  • underline - Put a horizontal line above the text. (Not widely supported)
  • overline - Put a horizontal line below the text. (Not widely supported)
  • inverse- Invert background and foreground colors.
  • hidden - Print the text but make it invisible.
  • strikethrough - Put a horizontal line through the center of the text. (Not widely supported)

Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • gray
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgGray
  • bgRedBright
  • bgGreenBright
  • bgYellowBright
  • bgBlueBright
  • bgMagentaBright
  • bgCyanBright
  • bgWhiteBright

Prior art

Yes

Benchmark

$ ./benchmark.js
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│ (index) │ library        │ ops/sec     │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│ 0       │ 'yoctocolors'  │ '8,000,000' │
│ 1       │ 'colorette'    │ '8,000,000' │
│ 2       │ 'picocolors'   │ '8,000,000' │
│ 3       │ 'nanocolors'   │ '5,988,024' │
│ 4       │ 'chalk'        │ '4,807,692' │
│ 5       │ 'kleur/colors' │ '4,807,692' │
│ 6       │ 'kleur'        │ '4,784,689' │
│ 7       │ 'ansi-colors'  │ '2,178,649' │
│ 8       │ 'cli-color'    │ '585,138'   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

See benchmark.js.

FAQ

What is yocto?

It was the smallest official unit prefix in the metric system until 2022. Much smaller than nano.

Related

  • yoctodelay - Delay a promise a given amount of time
  • chalk - Terminal string styling
wiki-translate-cliword-counter-h-a-atext-based-adventure-game-h-a-aapollo-oasitx_ahmed_arainjson-categorizehussein-code-add-coursesgrunt-pngminhassam-cli-my-bank-oopinquirer-reorder-listmateen_cli-number-guessingmera_simple_calculatormehak609calculatormehak650calculatormehak65calculator@travelaps/project-builder@vizzalan/basil@vizzalan/dinesh@vizzalan/npx-resume@vizzalan/package@zhrk/pack@zyy-im-cli/utilsadventure-game-by-emad-ahmedatm-machine-by-emad-ahmedasma12-student-management-system6domaincomponentebad_cli_calculatoreslint-formatter-interactiveembedexfaizanalee007-currency-convertercli_word_count_p5countdown-timer-h-abluesky-account-migrator@aruntestpayment/react-native-payu-paymentstudent_management_system_by_emad-ahmedstudent-management-system-h-a-atx256-cli-countdowntimermuskan-adventure-gamemohamed-salahmybank03b3oop-my-bank-by-emad234oop-bank-00react-native-ideo-rn-notificationsreact-native-payu-paymentreact-native-lazp-device-infos.u.a.ireact-native-test-multiplier-libraryproject07_adventure_ga3e3quiz-system-by-hamza0quiz-h-a-aquiz-from-emad-ahmedsmotslangsocket@eightshone/sshman@fabiankachlock/nui@inquirer/core@inquirer/rawlist@inquirer/checkbox@inquirer/expand@inquirer/demo@inquirer/search@inquirer/select@kb0912/medusa-sapo-plugin-v2@syedt/hellosdk@logisticinfotech/react-native-geocoding-reversegeocoding@orgbluetooth/react-native-payupayment@orgbluetooth/react-native-arunpayupayment@socketregistry/yocto-spinner@myscada/embedjs@ahmed_shaban123/react-native-currencyinput@ajorquera/components
2.1.2

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago