1.0.5 • Published 9 months ago

terminalpastel v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

TerminalPastel

Documentation

Table of Contents

Installation - Node JS

Navigate to your project folder in the cmd and run the following command.

npm install terminalpastel

Implementation - Web

Functions

  • format

tpastel.format('Hello World', {color: 'red', style: 'bold'}, true);

In this example, we are calling the tpastel.format function to format a string into a certain colour and/or style. The arguments passed into the function must take the following form.

argument1 - string to be formatted using Terminal Pastel argument 2 - an object containing 2 properties; 'color' and 'style' to specify what colour and style the text should be formatted to. Check out the Colours and Styles for more info. argument 3 - specifies whether the styles should be reset at the end of the string. If set to false, the styles will be carried to the next content logged to the console.

  • log

tpastel.log('Hello World', {color: 'yellow', style: 'bold'});

In this example, we are calling the tpastel.log function to format a string into a certain colour and/or style and log it to the console. The arguments passed into the function must take the following form.

argument1 - string to be formatted and logged to the console argument2 - an object containing 2 properties; 'color' and 'style' to specify what colour and style the text should be formatted to. Check out the Colours and Styles for more info.

  • f

tpastel.f('<Lorem ipsum:12> dolor, sit amet <consectetur:34>');

In this example, we call the pastel.f function. Instead of formatting the entire string, it formats parts of the string we specify using stylable blocks.

Stylable blocks are written in the following way.

<Text to be formatted:[style code][colour code]>

To get the colour/style codes, check out the Colours and Styles sections. Some example stylable blocks are given below.

<Lorem ipsum:11> // same as, {color: 'black', style: 'bold'};
<Lorem ipsum:34> // same as, {color: 'yellow', style: 'underline'};
<Lorem ipsum:36> // same as, {color: 'magenta', style: 'underline'};
<Lorem ipsum:42> // same as, {color: 'red', style: 'strikethrough'};

Colours

ColourValueCode
Defaultdefault0
Blackblack1
Redred2
Greengreen3
Yellowyellow4
Blueblue5
Magentamagenta6
Cyancyan7
Whitewhite8

Styles

StyleValueCode
Defaultdefault0
Boldbold1
Italicitalic2
Underlineunderline3
Strikethroughstrikethrough4

----- End -----

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago