{"_id":"@artiq/stylize","_rev":"8-d34cb5491c46840a8ac733cf2c60d524","name":"@artiq/stylize","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.2":{"name":"@artiq/stylize","version":"1.0.2","keywords":["terminal","style","ansi","chalk","color","figlet","cli","stylizer","proxy","ansi-colors","text","formatting"],"author":{"url":"https://github.com/fajardison","name":"Dimas Fajar"},"license":"MIT","_id":"@artiq/stylize@1.0.2","maintainers":[{"name":"fajardison","email":"dimasfajar9741@gmail.com"}],"homepage":"https://github.com/fajardison/artiq#readme","bugs":{"url":"https://github.com/fajardison/artiq/issues"},"dist":{"shasum":"5d2c91fba0b31513704f2bfb8c965da0ac17be18","tarball":"https://registry.npmjs.org/@artiq/stylize/-/stylize-1.0.2.tgz","fileCount":21,"integrity":"sha512-4Q0XbRPLRZdJKUf0R18YH2d4MaSBbIdCKmoUK5pYQ+tIgIQKUY1sJuGC+M7syR5FSvfVrpTEm6QVi9OmVafq7g==","signatures":[{"sig":"MEUCIAugmJ5OWO6BU6Gu1ZgKsTl0eRZmb0znw+dd4L5r7g4CAiEA11E0QhI8tieueydhAO7QCpp9uWrY89dAP6iYHB2KMGo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19999},"type":"module","engines":{"node":">=18.0.0"},"exports":{".":{"import":"./stylish/stylize.js","default":"./stylish/stylize.js"},"./package.json":"./package.json"},"_npmUser":{"name":"fajardison","email":"dimasfajar9741@gmail.com"},"repository":{"url":"git+https://github.com/fajardison/artiq.git","type":"git"},"_npmVersion":"10.9.2","description":"A terminal text stylizer with ANSI color support and modular styling system — supports chaining, style composition, proxy-based API, and multiple styling modes.","directories":{},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/stylize_1.0.2_1753193151542_0.5901215084982983","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@artiq/stylize","version":"1.0.3","keywords":["terminal","stylish","style","ansi","color","rgb","hex","figlet","cli","stylizer","ansi-colors","chalk-alternative","text","text-style","formatting"],"author":{"url":"https://github.com/fajardison","name":"Dimas Fajar"},"license":"MIT","_id":"@artiq/stylize@1.0.3","maintainers":[{"name":"fajardison","email":"dimasfajar9741@gmail.com"}],"homepage":"https://github.com/fajardison/artiq#readme","bugs":{"url":"https://github.com/fajardison/artiq/issues"},"dist":{"shasum":"093453913d367998606a7b19619c2e310c2a0c13","tarball":"https://registry.npmjs.org/@artiq/stylize/-/stylize-1.0.3.tgz","fileCount":28,"integrity":"sha512-5RyDYrDZgGHsrY0SlwaLbSGaQR0at1ib89w5nty2XrvxJyDXXz2nbcNklbxP31Rnipt1/bG97LhQFHTiioIwSQ==","signatures":[{"sig":"MEUCIDAv36rFUaiET17MVYIRtdgGjbBkA5MLp/in002rZGc9AiEAnxV3XvAkiMziFrEGM0kn4dbSlplvlfPGn5YVzdKiVEc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":127033},"type":"module","engines":{"node":">=22.0.0"},"exports":{".":{"import":"./stylish/stylize.js","default":"./stylish/stylize.js"},"./package.json":"./package.json"},"_npmUser":{"name":"fajardison","email":"dimasfajar9741@gmail.com"},"repository":{"url":"git+https://github.com/fajardison/artiq.git","type":"git"},"_npmVersion":"10.9.2","description":"Lightweight terminal text stylizer with ANSI, RGB, HEX colors, multiple styling modes, and chainable proxy API.","directories":{},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/stylize_1.0.3_1754416532392_0.33946368750460976","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@artiq/stylize","version":"1.0.4","description":"Lightweight terminal text stylizer with ANSI, RGB, HEX colors, multiple styling modes, and chainable proxy API.","type":"module","exports":{".":{"import":"./stylish/stylize.js","default":"./stylish/stylize.js"},"./package.json":"./package.json"},"keywords":["terminal","stylish","style","ansi","color","rgb","hex","figlet","cli","stylizer","ansi-colors","chalk-alternative","text","text-style","formatting"],"author":{"name":"Dimas Fajar","url":"https://github.com/fajardison"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/fajardison/artiq.git"},"bugs":{"url":"https://github.com/fajardison/artiq/issues"},"homepage":"https://github.com/fajardison/artiq#readme","engines":{"node":">=22.0.0"},"_id":"@artiq/stylize@1.0.4","_nodeVersion":"22.17.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-y0THAwap8ff9qK5C6+EqHBlYuJUNGoBzYD7nNIfu2j2nMopaTWGhBinotXIeCWDLFqg3eMb2Y5xdBKIgstgx6A==","shasum":"26bb70f791f74645e9dc94fd2816d88b9c98bf3f","tarball":"https://registry.npmjs.org/@artiq/stylize/-/stylize-1.0.4.tgz","fileCount":21,"unpackedSize":22635,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICiBU3rUACU5HWlTda4kEbouBNwATYIQClXNXOgjwmDBAiAvr9i3bIFsrUl0EOKPPp080kdQlQLKqL2HYl+7AKvjkg=="}]},"_npmUser":{"name":"fajardison","email":"dimasfajar9741@gmail.com"},"directories":{},"maintainers":[{"name":"fajardison","email":"dimasfajar9741@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stylize_1.0.4_1754418486982_0.22661114913134695"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-22T14:05:51.445Z","modified":"2025-08-05T18:28:07.343Z","1.0.0":"2025-07-22T12:28:48.628Z","1.0.1":"2025-07-22T13:52:06.230Z","1.0.2":"2025-07-22T14:05:51.713Z","1.0.3":"2025-08-05T17:55:32.697Z","1.0.4":"2025-08-05T18:28:07.168Z"},"bugs":{"url":"https://github.com/fajardison/artiq/issues"},"author":{"name":"Dimas Fajar","url":"https://github.com/fajardison"},"license":"MIT","homepage":"https://github.com/fajardison/artiq#readme","keywords":["terminal","stylish","style","ansi","color","rgb","hex","figlet","cli","stylizer","ansi-colors","chalk-alternative","text","text-style","formatting"],"repository":{"type":"git","url":"git+https://github.com/fajardison/artiq.git"},"description":"Lightweight terminal text stylizer with ANSI, RGB, HEX colors, multiple styling modes, and chainable proxy API.","maintainers":[{"name":"fajardison","email":"dimasfajar9741@gmail.com"}],"readme":"![npm](https://img.shields.io/npm/v/@artiq/stylize)\n![License](https://img.shields.io/npm/l/@artiq/stylize)\n![ESM](https://img.shields.io/badge/javascript-ESM-orange)\n![Node](https://img.shields.io/badge/node-%3E=22.0.0-green)\n\n# @artiq/stylize\n\nA minimalist ANSI styling tool for text formatting — made for simplicity, flexibility, and extensibility.\n\n---\n\n## ✨ Key Features\n\n- 🎨 **Rich Styling Support** – ANSI modifiers, foreground/background colors, 8-bit RGB, HEX\n- 🔗 **Chainable Proxy API** – Use `.bold.red.bgBlue(...)` with full IntelliSense\n- ⚙️ **Flexible Application** – Apply styles per character, word, line, or sentence\n- 🧪 **Runtime Safe** – Auto-validates styles and mode usage\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install @artiq/stylize\n```\n\n> This package is **ESM only**, make sure you have `\"type\": \"module\"` in your `package.json`.\n\n---\n\n## 🎨 Supported Styles\n\n### Modifiers\n```\nbold, dim, italic, underline, inverse, hidden, strikethrough\n```\n\n### Foreground Colors\n```\nblack, red, green, yellow, blue, magenta, cyan, white,\ngray, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite\n```\n\n### Background Colors\n\nPrefix with `bg` + capitalized color, e.g.:\n\n```\nbgRed, bgBlue, bgGreen, bgBrightCyan, bgWhite, etc.\n```\n\n> Each word will receive a random style from the `styleSets`.\n\n---\n\n## 📘 API Reference\n\n### `stylize(text, styleSets, options?)`\n\n| Param       | Type         | Description                                         |\n|-------------|--------------|-----------------------------------------------------|\n| `text`      | `string`     | The raw text to stylize                             |\n| `styleSets` | `string[][]` | Array of style groups                               |\n| `options`   | `object`     | Optional: `style` (mode), `randomize` (boolean)     |\n\n---\n\n### `resolveAnsiStyles(styles: string[])`\n\nResolve an array of styles to a single ANSI escape sequence.\n\n---\n\n## 🚀 Getting Started\n\n### Import package\n```js\nimport stylize from '@artiq/stylize';\n```\n\n---\n\n### Basic Style\n```js\nconsole.log(stylize(\n  'HELLO ARTIQ',\n  [['bold', 'red']],\n  { style: 'word' }\n));\n\nconsole.log(stylize('HELLO STYLIZE', [['italic', 'green']]));\n```\n\n**Result:**\n![Basic Style 1](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/basic-style1.png)  \n![Basic Style 2](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/basic-style2.png)\n\n\n---\n\n### Using Multiple Styles (`styleSets`)\n```js\nconst styleSets = [\n  ['green', 'bold'],\n  ['blue', 'italic'],\n  ['yellow', 'dim'],\n  ['magenta'],\n  ['cyan', 'underline']\n];\n\nconsole.log(stylize(\n  'Stylize is fun and colorful!',\n  styleSets,\n  { style: 'word' }\n));\n```\n\n**Result:**\n![Multiple Stylize](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/multiple-styles.png)\n\n---\n\n### Available Modes\n\n| Mode       | Description               |\n|------------|---------------------------|\n| `char`     | Apply style per character |\n| `word`     | Apply style per word      |\n| `line`     | Apply style per line      |\n| `sentence` | Apply style per sentence  |\n\n---\n\n### 🧩 Proxy API (Chaining Style)\n```js\nconsole.log(\n  stylize.yellow.bold.underline('HELLO ARTIQ STYLIZE')\n);\n```\n\n**Result:**\n![Chaining Style](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/chained-style.png)\n\n---\n\n### Custom RGB & HEX\n\n```js\nconst stylesRGB = [\n  ['bold', 'rgb(255,0,0)'],\n  ['underline', 'rgb(0,255,0)'],\n  ['italic', 'rgb(0,0,255)'],\n  ['bgRgb(255,255,0)', 'black']\n];\n\nconsole.log(\n  stylize('Hello colorful style rgb', stylesRGB, { style: 'word', randomize: false })\n);\n\nconst stylesHEX = [\n  ['#00FFFF', 'underline'],\n  ['#ff0000', 'strikethrough'],\n  ['bg#00FF00'],\n  ['bg#333333'],\n  ['dim']\n];\n\nconsole.log(stylize('Hello colorful style hex', stylesHEX, { style: 'word' }));\n```\n\n**Result:**\n![RGB](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/rgb.png)  \n![HEX](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/hex.png)\n\n---\n\n### 🔀 Advanced: Random & Gradient Application\n\n#### Randomize Style per Segment\n```js\nconsole.log(stylize(\n  'Random style fun',\n  [['red'], ['blue', 'italic'], ['green', 'underline']],\n  { style: 'word', randomize: true }\n));\n```\n\n**Result:**\n![Randomize Style](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/doc/random-style.png)\n\n---\n\n## 👤 Author\n\n**[Dimas Fajar](https://github.com/fajardison)**\n\n---\n\n## ⚖️ License\n\nThis project is licensed under the **MIT License** – see the [LICENSE](https://raw.githubusercontent.com/fajardison/artiq-stylize/refs/heads/main/LICENSE) file for details.\n","readmeFilename":"README.md"}