Skip to content

Colours and styles

To use colours (other than &codes) inline, you must import leeks.js (which you have already installed as it is one of the dependencies).


Require leeks.js to use inline colours other than &codes:

const leeks = require('leeks.js');

I recommend using &codes instead if you want to use inline colours.

Using overrides:, [foregroundColour]);, [foregroundColour, backgroundColour]);, [backgroundColour]); // only works for colour names and short codes, not RGB/HEX/8Bit

where foregroundColour and backgroundColour are resolvable colours.


If you give both a foreground and background colour, and the background colour given is the name or &code of a foreground colour, the background colour will be converted to an actual background colour. As RGB/HEX/8bit colours do not have specific foreground/background codes, if you wish to use an RGB/HEX/8bit colour for the background you must also give a foreground colour.

Types of colours

leeks.js / colour name

A name of a colour (string or function).

A full list of leeks.js colour names and style names can be found here.'some text', ['blue', 'black']);
// or'some text', ['blue', 'bgBlack']);`this part is normal info colour ${'but this part is red')},
although this is also red :(`); // better to use &codes for inline


A string of numbers separated by commas (with or without spaces).

See leeks.js docs for inline usage.'some text', ['123, 123, 123', '321, 321, 321']);


A string with a HEX code (with hashtag).

See leeks.js docs for inline usage.'some text', ['#AABBCC', '#123456']);


A number. You will get an error if you try to put the number in a string.

See leeks.js docs for inline usage.'some text', [16, 1]);

Short codes

A string containing an &fg or &!bg short code for a leeks.js colour. All short codes are listed below.

Don't put a space between codes and text when using them inline (&cred not &c red) as the space will show.

Use Logger.f(String) or Logger.format(String) to use inline colours.'some text', ['&a', '&0']);
// or'some text', ['&a', '&!0']);`this is normal info colour, &athis is light green
&3,and it\'s easy to return to the normal colour`));

leeks.js short codes

Foreground colours
Code leeks.js
&0 black
&1 blue
&2 green
&3 cyan
&4 red
&5 magenta
&6 yellow
&7 blackBright
&8 whiteBright
&9 blueBright
&a greenBright
&b cyanBright
&c redBright
&d magentaBright
&e yellowBright
&f white
Background colours
Code leeks.js
&!0 bgBlack
&!1 bgBlue
&!2 bgGreen
&!3 bgCyan
&!4 bgRed
&!5 bgMagenta
&!6 bgYellow
&!7 bgBlackBright
&!8 bgWhiteBright
&!9 bgBlueBright
&!a bgGreenBright
&!b bgCyanBright
&!c bgRedBright
&!d bgMagentaBright
&!e bgYellowBright
&!f bgWhite
Code leeks.js
&i inverse
&j dim
&k blink
&l bold
&m strikethrough
&n underline
&o italic
&r reset

Last update: April 1, 2021