Skip to main content
Module

x/crayon/mod.ts

🖍️ Terminal styling done light and fast.
Go to Latest
import * as crayon from "https://deno.land/x/crayon@3.3.2/mod.ts";

Variables

Converts 8Bit (256) ANSI color representation to 4Bit (16) ANSI

Map containing all supported attributes

Map containing all 4bit colors

An object that expresses how well terminal supports displaying colors

🖍️ Crayon object that's used for styling

  • Call the last property as a function with arguments to get styled string

Map containing all style functions used by crayon

Object, which gets set as the prototype of every generated crayon instance in generateCrayon() function

Map containing all styles used by crayon

Functions

Generate StyleCode from 3bit (8) color pallete

Generate StyleCode from 4bit (16) color pallete

Converts 4Bit (16) ANSI color representation to 3Bit (8) ANSI

Generate StyleCode from 8bit (256) color pallete

Return whether NO_COLOR is set

Generate StyleCode from HEX value - 24bit (16.7m) color pallete

Generate StyleCode from HSL values - 24bit (16.7m) color pallete

Converts HSL color representation to RGB

Return whether program is running in deno runtime

Return whether program is running in node runtime

Retrieve style using string

Uses mapFunc on every given function

  • func.name will be considered as name parameter

Uses mapStyle on every given style code

  • map key will be used as name parameter

Faster alternative to String.prototype.replace

Faster¹ alternative to String.prototype.replaceAll

Generate StyleCode from RGB values - 24bit (16.7m) color pallete

Converts RGB color representation to 4Bit (16) ANSI

Converts RGB color representation to 8Bit (256) ANSI

Type Aliases

All supported attributes

Names for all 4bit colors

Crayon type which can be easily extended C - literal string type for extending styles O - object which expands

Get keys of a map

Get values of a map

Every possible style

ANSI escape code