Add colors to your terminal!
Tags: npm, node, typescript, javascript
Published: 2023-04-25 17:01:48

### **[Tintify](https://www.npmjs.com/package/tintify)** is an NPM package that brings you all you need to add colors and effects to your terminal!

This package isn't a simple list of ANSI escape sequences.
It brings you utilities functions that permit you to use custom RGB colors or the HEXADECIMAL notations.
In future update, we will bring you others functions like new formatters. Current formatters permit you to transform your message into an **rainbow** text, a linear gradient between two colors, a matrix style text or a format function where you can pass flags to replace with a color *(ie: flag `§3` or `§b` will be transformed to a color or effect according to the config)*

---
## Installation
```cmd
npm install tintify
```
OR
```cmd
pnpm install tintify
```

---
## Updates
Want to see new content? [Open an issue!](https://github.com/Unarray/Tintify/issues)

---
## Overview
### Basic usage
#### Usage of constants
```js
import { forground, brightBackground } from "tintify";

console.log(`${forground.blue}Hello ${forground.red}${brightBackground.blue}World!`);
```
![basic usage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8e6ykcvg25fkxs7t3ca6.jpg)

#### Usage of functions
```js
import { forgroundRGBColor, backgroundRGBColor, hexToRgb } from "tintify";

const helloFgColor = forgroundRGBColor({red: 63, green: 112, blue: 84});
const worldFgColor = forgroundRGBColor(hexToRgb("#9d19c2"));
const worldBgColor = backgroundRGBColor({red: 63, green: 112, blue: 84});

console.log(`${helloFgColor}Hello ${worldFgColor}${worldBgColor}World!`);
```
![RGB/Hex values](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/55a3z4ew7y6jhzhzrs0w.jpg)

### Formatters usage
#### Linear gradient effect
```js
import { hexToRgb, linearGradient } from "tintify";

console.log(linearGradient("Tintify tints your untinted terminal", hexToRgb("#40db21"), {red: 255, green: 0, blue: 0}));
```
![linear gradient](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kycjqafvkpksm968wwpl.jpg)

#### Matrix effect
```js
import { hexToRgb, matrix } from "tintify";

console.log(matrix("Tintify tints your untinted terminal", hexToRgb("#00FF00")));
console.log(matrix("Tintify tints your untinted terminal", hexToRgb("#00FF00"), 200));
```
![matrix](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccm0x5f2amrpqa5h7xea.jpg)

#### Rainbow effect
```js
import { hexToRgb, rainbow } from "tintify";

console.log(rainbow("Tintify   tints   your   untinted   terminal"));
console.log(rainbow("Tintify   tints   your   untinted   terminal", hexToRgb("#00FF00")));
console.log(rainbow("Tintify   tints   your   untinted   terminal", hexToRgb("#00FF00"), 100));
console.log(rainbow("Tintify   tints   your   untinted   terminal", hexToRgb("#00FF00"), 100, false));
```
![rainbow](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/60rl915ito6ep3aq7tgm.jpg)

#### Format
```js
import { defaultFormatConfig, forground, format } from "tintify";

console.log(format("§2Hello §b§4World!"));
console.log(format("§2Hello §b§4World!", {
  ...defaultFormatConfig,
  "§2": forground.blue
}));
```
![format](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8nzrlllihi0tuh5dq97.jpg)

## Links
- 📦 [NPM](https://www.npmjs.com/package/tintify)
- 🐙 [Github](https://www.npmjs.com/package/tintify)