├── .gitignore ├── package.json ├── readme.md ├── index.js └── index.ts /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | testing -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "colorlufy", 3 | "version": "1.0.0", 4 | "description": "this npm package is used to color the text in the console in a lufy way", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/GhaythBenAbid/colorlufy.git" 9 | }, 10 | "author": "Ghayth Ben Abid ", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "typescript": "^4.7.4" 14 | }, 15 | "keywords": [ 16 | "color", 17 | "lufy", 18 | "console", 19 | "github" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Installation 2 | 3 | To install and set up the library, run: 4 | 5 | ```sh 6 | $ npm i colorlufy 7 | ``` 8 | 9 | Or if you prefer using Yarn: 10 | 11 | ```sh 12 | $ yarn add colorlufy 13 | ``` 14 | 15 | ## Usage 16 | 17 | ```js 18 | const {color} = require("colorlufy"); 19 | 20 | console.log(color("BgMagenta" , "Hello World")); 21 | ``` 22 | 23 | 24 | ## Built With 25 | 26 | * TypeScript 27 | 28 | ## Authors 29 | 30 | * **Ghayth Ben Abid** - [Ghayth Ben Abid](https://github.com/GhaythBenAbid) 31 | 32 | ## License 33 | 34 | [MIT License](https://andreasonny.mit-license.org/2019) 35 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | exports.__esModule = true; 3 | exports.color = void 0; 4 | var colors = { 5 | "Reset": "\x1b[0m", 6 | "Bright": "\x1b[1m", 7 | "Dim": "\x1b[2m", 8 | "Underscore": "\x1b[4m", 9 | "Blink": "\x1b[5m", 10 | "Reverse": "\x1b[7m", 11 | "Hidden": "\x1b[8m", 12 | "FgBlack": "\x1b[30m", 13 | "FgRed": "\x1b[31m", 14 | "FgGreen": "\x1b[32m", 15 | "FgYellow": "\x1b[33m", 16 | "FgBlue": "\x1b[34m", 17 | "FgMagenta": "\x1b[35m", 18 | "FgCyan": "\x1b[36m", 19 | "FgWhite": "\x1b[37m", 20 | "BgBlack": "\x1b[40m", 21 | "BgRed": "\x1b[41m", 22 | "BgGreen": "\x1b[42m", 23 | "BgYellow": "\x1b[43m", 24 | "BgBlue": "\x1b[44m", 25 | "BgMagenta": "\x1b[45m", 26 | "BgCyan": "\x1b[46m", 27 | "BgWhite": "\x1b[47m" 28 | }; 29 | function color(color, text) { 30 | return colors[color] + text + colors["Reset"]; 31 | } 32 | exports.color = color; 33 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | type colorsType = "Reset" | "Bright" | "Dim" | "Underscore" | "Blink" | "Reverse" | "Hidden" | "FgBlack" | "FgRed" | "FgGreen" | "FgYellow" | "FgBlue" | "FgMagenta" | "FgCyan" | "FgWhite" | "BgBlack" | "BgRed" | "BgGreen" | "BgYellow" | "BgBlue" | "BgMagenta" | "BgCyan" | "BgWhite" 2 | 3 | 4 | 5 | const colors = { 6 | "Reset": "\x1b[0m", 7 | "Bright": "\x1b[1m", 8 | "Dim": "\x1b[2m", 9 | "Underscore": "\x1b[4m", 10 | "Blink": "\x1b[5m", 11 | "Reverse": "\x1b[7m", 12 | "Hidden": "\x1b[8m", 13 | "FgBlack": "\x1b[30m", 14 | "FgRed": "\x1b[31m", 15 | "FgGreen": "\x1b[32m", 16 | "FgYellow": "\x1b[33m", 17 | "FgBlue": "\x1b[34m", 18 | "FgMagenta": "\x1b[35m", 19 | "FgCyan": "\x1b[36m", 20 | "FgWhite": "\x1b[37m", 21 | "BgBlack": "\x1b[40m", 22 | "BgRed": "\x1b[41m", 23 | "BgGreen": "\x1b[42m", 24 | "BgYellow": "\x1b[43m", 25 | "BgBlue": "\x1b[44m", 26 | "BgMagenta": "\x1b[45m", 27 | "BgCyan": "\x1b[46m", 28 | "BgWhite": "\x1b[47m", 29 | } 30 | 31 | 32 | function color(color: colorsType, text: string) { 33 | return colors[color] + text + colors["Reset"]; 34 | } 35 | 36 | 37 | //export color function 38 | export { color }; 39 | 40 | --------------------------------------------------------------------------------