{"id":27290961,"url":"https://github.com/kabeep/palette","last_synced_at":"2026-02-13T21:14:35.588Z","repository":{"id":273399463,"uuid":"919596871","full_name":"kabeep/palette","owner":"kabeep","description":"🎨 A Node.js library for terminal text colour \u0026 style in FP.","archived":false,"fork":false,"pushed_at":"2025-10-22T10:37:06.000Z","size":185,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T11:30:47.483Z","etag":null,"topics":["ansi","chalk","cli","color","console","nodejs","terminal"],"latest_commit_sha":null,"homepage":"https://kabeep.github.io/palette/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kabeep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-20T17:24:02.000Z","updated_at":"2025-10-22T10:36:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"d75672d3-a8b1-4496-90ad-ebfe056a8383","html_url":"https://github.com/kabeep/palette","commit_stats":null,"previous_names":["kabeep/palette"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kabeep/palette","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fpalette","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fpalette/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fpalette/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fpalette/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kabeep","download_url":"https://codeload.github.com/kabeep/palette/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kabeep%2Fpalette/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29417790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi","chalk","cli","color","console","nodejs","terminal"],"created_at":"2025-04-11T21:39:42.973Z","updated_at":"2026-02-13T21:14:35.572Z","avatar_url":"https://github.com/kabeep.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ch1\u003ePalette\u003c/h1\u003e\n\n🎨 A Node.js library for terminal text colour \u0026 style in FP.\n\n[![NodeJS][node-image]][node-url]\n[![License][license-image]][license-url]\n[![NPM][npm-image]][npm-url]\n[![Codecov][codecov-image]][codecov-url]\n[![BundlePhobia][bundle-phobia-image]][bundle-phobia-url]\n[![CircleCI][circleci-image]][circleci-url]\n\nEnglish | [简体中文][zh-cn-url]\n\n\u003c/div\u003e\n\n## 📖 Introduction\n\n\u003e `chalk` offers a user-friendly, chainable API.\n\u003e In spite of the excellent work done by @sindresorhus to reduce the size of the packaging as much as possible.\n\u003e But my view is that the key issue is not [\"Why not switch to a smaller coloring package?\"][chalk-faq-url].\n\u003e Here’s why:\n\u003e - No tree-shaking support, and no FP such as pipe/compose.\n\u003e - You will still need to create the full `chalk` using the factory function\n\u003e if you only need to colour the red failure and green success messages.\n\u003e - In lightweight scenarios, _static ANSI strings_ are much more cost-effective.\n\nSo I created this package.\nIt supports ANSI _16 colours_, _256 colours_ and _16 million true colours_ like `chalk`.\nCompared to other lightweight alternatives, it goes beyond basic ANSI keywords and also supports\n_[Hex Triplet][hex-triplet-url]_, _[RGB Color Model][rgb-model-url]_, and _[CSS Keywords][css-keywords-url]_.\n\nBut this does not mean it compromises on **size** or **performance**.\nOn the contrary, it performs excellently in [Benchmark Reports][perf-en-us-url].\nOf course, all the coloring packages are more than fast enough,\nI am just saying `@kabeep/palette` is a good choice for people who value size and performance.\n\nSee [documentation][docs-url].\n\n## 📦 Installation\n\n```bash\nnpm install @kabeep/palette --save\n```\n\n```bash\nyarn add @kabeep/palette\n```\n\n```bash\npnpm add @kabeep/palette\n```\n\n## ⚙️ Usage\n\n**CommonJS**\n\n```typescript\nconst pipe = require('lodash.flow');\nconst { bgRgb, hex, keyword, yellowBright } = require('@kabeep/palette');\n\nconst padding = (text: string) =\u003e ` ${text} `;\nconst palette = pipe(keyword('gold'), padding, bgRgb(255, 0, 0));\n\nconsole.log(palette('Error'), yellowBright('Warning'), hex('#ff0000')('Message'));\n```\n\n**ESModule**\n\n```typescript\nimport pipe from 'lodash.flow';\nimport { bgRgb, hex, keyword, yellowBright } from '@kabeep/palette';\n\nconst padding = (text: string) =\u003e ` ${text} `;\nconst palette = pipe(keyword('gold'), padding, bgRgb(255, 0, 0));\n\nconsole.log(palette('Error'), yellowBright('Warning'), hex('#ff0000')('Message'));\n```\n\n## 🌈 Styles\n\n### Modifiers\n\n- reset - Reset the current style.\n- bold - Make the text bold.\n- dim - Make the text have lower opacity.\n- italic - Make the text italic. (Not widely supported)\n- underline - Put a horizontal line above the text. (Not widely supported)\n- overline - Put a horizontal line below the text. (Not widely supported)\n- inverse- Invert background and foreground colors.\n- hidden - Print the text but make it invisible.\n- strikethrough - Put a horizontal line through the center of the text. (Not widely supported)\n\n### Foreground Colors\n\n- black\n- red\n- green\n- yellow\n- blue\n- magenta\n- cyan\n- white\n- gray\n- redBright\n- greenBright\n- yellowBright\n- blueBright\n- magentaBright\n- cyanBright\n- whiteBright\n\n### Background Colors\n\n- bgBlack\n- bgRed\n- bgGreen\n- bgYellow\n- bgBlue\n- bgMagenta\n- bgCyan\n- bgWhite\n- bgGray\n- bgRedBright\n- bgGreenBright\n- bgYellowBright\n- bgBlueBright\n- bgMagentaBright\n- bgCyanBright\n- bgWhiteBright\n\n### Hex Triplet\n\n- hex - (three-digit) #fff, ...\n- hex - (six-digit) #ffffff, ...\n- hex - (without hashtag) fff, ffffff, ...\n\n### RGB Color Model\n\n- rgb - (255, 255, 255), ...\n\n### CSS Color Keywords\n\nSee the full list at [W3C Wiki][css-keywords-url].\n\n- keyword - azure, gold, indigo, ...\n\n## 💐 Credits\n\n- [ansi-styles][ansi-styles-url] - Implement hexToRgb function.\n- [chalk-pipe][chalk-pipe-url] - Collating cssKeywords data.\n- [yoctocolors][yoctocolors-url] - Implement format function \u0026 style description.\n\n## 🔗 Related\n\n- [palette-cli][palette-cli-url] - A Node.js Library to make your terminal input colorful.\n\n## 🤝 Contribution\n\nContributions via Pull Requests or [Issues][issues-url] are welcome.\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE][license-url] file for details.\n\n\n[node-image]: https://img.shields.io/node/v/%40kabeep%2Fpalette?color=lightseagreen \"Node.js Version\"\n[node-url]: https://nodejs.org\n\n[npm-image]: https://img.shields.io/npm/d18m/%40kabeep%2Fpalette?color=cornflowerblue \"NPM Downloads\"\n[npm-url]: https://www.npmjs.com/package/@kabeep/palette\n\n[codecov-image]: https://img.shields.io/codecov/c/github/kabeep/palette?logo=codecov\u0026color=mediumvioletred \"Test Coverage\"\n[codecov-url]: https://codecov.io/gh/kabeep/palette\n\n[bundle-phobia-image]: https://img.shields.io/bundlephobia/minzip/@kabeep/palette \"Bundle Size\"\n[bundle-phobia-url]: https://bundlephobia.com/package/@kabeep/palette\n\n[circleci-image]: https://dl.circleci.com/status-badge/img/gh/kabeep/palette/tree/master.svg?style=shield \"Build Status\"\n[circleci-url]: https://dl.circleci.com/status-badge/redirect/gh/kabeep/palette/tree/master\n\n[hex-triplet-url]: https://en.wikipedia.org/wiki/Web_colors#Hex_triplet\n[rgb-model-url]: https://en.wikipedia.org/wiki/RGB_color_model\n[css-keywords-url]: https://www.w3.org/wiki/CSS/Properties/color/keywords\n\n[ansi-styles-url]: https://github.com/chalk/chalk/blob/main/source/vendor/ansi-styles/index.js#L134\n[chalk-pipe-url]: https://github.com/LitoMore/chalk-pipe/blob/main/source/styles.ts\n[yoctocolors-url]: https://github.com/sindresorhus/yoctocolors/blob/main/base.js#L27\n[chalk-faq-url]: https://github.com/chalk/chalk?tab=readme-ov-file#why-not-switch-to-a-smaller-coloring-package\n[palette-cli-url]: https://github.com/kabeep/palette-cli\n\n[license-image]: https://img.shields.io/github/license/kabeep/palette?color=slateblue \"License\"\n[license-url]: LICENSE\n\n[perf-en-us-url]: performance/PERFORMANCE.md\n[zh-cn-url]: README.zh-CN.md\n\n[docs-url]: https://kabeep.github.io/palette\n[issues-url]: https://github.com/kabeep/palette/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fpalette","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkabeep%2Fpalette","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkabeep%2Fpalette/lists"}