Git Product home page Git Product logo

yoctocolors's Introduction

yoctocolors ๐ŸŒˆ

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

The only thing that matters is micro-benchmark performance! โšก๏ธ

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

Features

  • 4x faster and 5x smaller than nanocolors
  • Cat friendly
  • An additional color
  • Tree-shakeable, not stirred
  • Actively maintained (at least for another week)
  • No dependencies

Install

npm install yoctocolors

Usage

import * as colors from 'yoctocolors';

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

This package does not do color support detection. Check out supports-color if you need that. Node.js will hopefully get built-in support for color support detection at some point.

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

Background colors

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgMagenta
  • bgCyan
  • bgWhite
  • bgGray

Prior art

Yes

Benchmark

โฏ ./test/simple-benchmark.js
nanocolors    31508276 ops/sec
picocolors    32524769 ops/sec
yoctocolors   132894792 ops/sec

Benchmark from nanocolors

FAQ

Why?

See this discussion.

What is yocto?

It's the smallest official unit prefix in the metric system. Much smaller than nano.

Related

  • yoctodelay - Delay a promise a given amount of time
  • chalk - Terminal string styling

yoctocolors's People

Contributors

sindresorhus avatar andrea-mariadb-2 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.