1.0.0 • Published 2 years ago

discord-ansi v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

this library allows for you to make a colorized message

example:

note:

most of ansi colors are not supported in discord just use the supported colors in this library (ansi colors are not supported in discord mobile application)

usage:

the usage is simillar to chalk npm

const DiscordAnsi = require("discord-ansi"); // or .default (returns new Ansi();)

DiscordAnsi.Ansi; // The Ansi class (you can use it directly without making one module.exports = new Ansi();)
DiscordAnsi.createAnsi(string); // create the ansi code block to make it more easier
DiscordAnsi.bold()("string"); // return "string" but with discord ansi (bold font)
DiscordAnsi.bold(); // returns its self so you can use the other methods to add more styles

methods

all methods have a name describe it self most of methods returns Function { self } so you can use other methods easily

Ansi#white

Ansi#cyan

Ansi#pink

Ansi#blue

Ansi#yellow

Ansi#green

Ansi#red

Ansi#gray

Ansi#grey

Ansi#underline

Ansi#bold

Ansi#normal

Ansi#reset

Ansi#bgReset

Ansi#bgWhite

Ansi#bgLightGray

Ansi#bgLightGrey

Ansi#bgIndigo

Ansi#bgGray

Ansi#bgGrey

Ansi#bgGreyishTurquoise

Ansi#bgMarbleBlue

Ansi#bgOrange

Ansi#bgFirelyDarkBlue

Ansi#resetAll

Ansi#print (Protected)

Ansi#toAnsi

bg

the background color number

fg

the font color number

type

the type of color (bold, underline, normal => none)

style

the style ansi codes

Advanced Usage:

the colors codes are the most important thing you need to know

fg colors

(number). code: name (1). 30: Gray (2). 31: Red (3). 32: Green (4). 33: Yellow (5). 34: Blue (6). 35: Pink (7). 36: Cyan (8). 37: White

bg Colors

(number). code: name (1). 40: Firefly dark blue (2). 41: Orange (3). 42: Marble blue (4). 43: Greyish turquoise (5). 44: Gray (6). 45: Indigo (7). 46: Light gray (8). 47: White

Types

(number). code: type (1). 0: normal (2). 1: Bold (3). 2: underline