{"id":15495671,"url":"https://github.com/probablykasper/colorboy-js","last_synced_at":"2025-03-02T08:43:39.613Z","repository":{"id":57203385,"uuid":"134188801","full_name":"probablykasper/colorboy-js","owner":"probablykasper","description":"Easy terminal coloring for Node.js, macOS/Linux","archived":false,"fork":false,"pushed_at":"2020-09-05T19:32:20.000Z","size":228,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T03:47:34.746Z","etag":null,"topics":["ansi","cli","color","package","terminal"],"latest_commit_sha":null,"homepage":"https://npmjs.com/package/colorboy","language":"JavaScript","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/probablykasper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-20T21:36:49.000Z","updated_at":"2021-12-31T06:54:32.000Z","dependencies_parsed_at":"2022-09-17T06:30:39.084Z","dependency_job_id":null,"html_url":"https://github.com/probablykasper/colorboy-js","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probablykasper%2Fcolorboy-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probablykasper%2Fcolorboy-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probablykasper%2Fcolorboy-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probablykasper%2Fcolorboy-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/probablykasper","download_url":"https://codeload.github.com/probablykasper/colorboy-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241482033,"owners_count":19969847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","cli","color","package","terminal"],"created_at":"2024-10-02T08:18:28.558Z","updated_at":"2025-03-02T08:43:39.595Z","avatar_url":"https://github.com/probablykasper.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# colorboy\nEasily add color to your `console.log`s in Node.js.\n\n## Installation\n```\nnpm install colorboy\n```\n\n## Usage\n```js\nrequire(\"colorboy\").addDefaults();\nconsole.log(\"Globgogabgalab\".red);\nconsole.log(\"Potato chips\".cyan.underline.italic);\nconsole.log(\"The Eden Project\".color(\"#067CB6\").bgColor(25, 25, 150).bold);\n```\n![screenshot1](./screenshot1.png)\n\n## Colors\nBelow you can see how to specify colors. To specify a background color, simply use `.bgColor()` instead of `.color()`.\n- Colors added by `addDefaults()`:\n    ```js\n    'Sonic'.cyan\n    ```\n    Can be `red`, `black`, `green`, `yellow`, `blue`, `pink`, `cyan`, `white` or `gray`\n- A [CSS keyword](https://www.w3.org/wiki/CSS/Properties/color/keywords): `'Sonic'.color('crimson')`\n- A hex code:\n    ```js\n    'Sonic'.color('#FF00FF')\n    ```\n- An rgb code:\n    ```js\n    'Sonic'.color(220, 20, 60)\n    ```\n- An rgb code:\n    ```js\n    'Sonic'.color(220, 20, 60, 'rgb')\n    ```\n- An hsl code:\n    ```js\n    'Sonic'.color(32, 100, 100, 'hsl')\n    ```\n- An hsv code:\n    ```js\n    'Sonic'.color(32, 100, 50, 'hsv')\n    ```\n- An hwb code:\n    ```js\n    'Sonic'.color(32, 0, 50, 'hwb')\n    ```\n\nPassing arrays works too:\n```js\n// the following are equivalent:\n'Sonic'.color(220, 20, 60)\n'Sonic'.color([220, 20, 60])\n\n// the following are equivalent:\n'Sonic'.color(32, 100, 100, 'hsl')\n'Sonic'.color([32, 100, 100, 'hsl'])\n```\n\n## Styles\nUse styles added by `addDefaults()`:\n```js\n'Sonic'.bold\n```\nCan be `bold`, `dim`, `italic`, `underline`, `inverse` and `strikethrough`\n\nWhen specifying custom styles, you can pass a string or an array of strings. These are the possible strings:\n- `\"bold\"`\n- `\"dim\"`\n- `\"italic\"`\n- `\"underline\"`\n- `\"inverse\"`\n- `\"strikethrough\"`\n- `\"reset\"`\n- `\"hidden\"`\n- `\"visible\"`\n\n## Custom colors \u0026 styles\n```js\nlet currentBgColor = 'red';\n\nrequire('./index.js')\n  .addColor(\"crimson\", {color:\"crimson\"})\n  .addColor('greenish', {\n    color: '#000000',\n    bgColor: '#00FE7C',\n    style: ['bold', 'italic'],\n  })\n  .addColorFunction('error', (color) =\u003e {\n    return {\n      color: color,\n      bgColor: currentBgColor,\n    }\n  })\nconsole.log('Custom:');\nconsole.log('Unlike Pluto'.greenish);\nconsole.log('Unlike Pluto'.error('white'));\ncurrentBgColor = 'cyan'\nconsole.log('Unlike Pluto'.error('black'));\n```\n![screenshot2](./screenshot2.png)\n\n### colorboy.addDefaults(functions = true, colors = true, styles = true)\nAdds the default colorboy colors \u0026 styles. Takes three optional arguments, all true by default.\n- `functions`: Whether to add the default functions prototypes (`color`, `bgColor` and `style`)\n- `colors`: Whether to add the default colors prototypes (`red`, `green`, etc)\n- `styles`: Whether to add the default styles prototypes (`bold`, `underline`, etc)\n\n### colorboy.addColor(name, options)\nAdds a color prototype.\n- `name`: The prototype name\n- `options`: A `color object` (see below)\n\n### colorboy.addColorFunction(name, optionsCallback)\n- `name`: The prototype name.\n- `options`: A function that returns a `color object` (see below).\n\n### color object\nAn object that defines colors and styles, in this format:\n```\n{\n    color: COLOR,\n    bgColor: COLOR,\n    style: STYLE\n}\n```\n\n## Dev instructions\n\n### Get started\n1. Install Node.js\n2. Run `npm install`\n\nTo test, run:\n```\nnpm run test\n```\n\n### Publish new version\n1. Update CHANGELOG.md\n2. Bump the version number, commit and tag:\n    ```\n    npm version \u003cversion\u003e\n    ```\n3. Publish to npm:\n    ```\n    npm publish\n    ```\n4. Create GitHub release with release notes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprobablykasper%2Fcolorboy-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprobablykasper%2Fcolorboy-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprobablykasper%2Fcolorboy-js/lists"}