{"id":21744542,"url":"https://github.com/cdoco/ansi-styles","last_synced_at":"2025-03-21T01:42:00.845Z","repository":{"id":62500446,"uuid":"110775441","full_name":"cdoco/ansi-styles","owner":"cdoco","description":"ANSI escape codes for styling strings in the terminal","archived":false,"fork":false,"pushed_at":"2017-11-15T03:54:27.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T05:41:37.261Z","etag":null,"topics":["ansi-colors","ansi-styles","console-color"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/cdoco.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}},"created_at":"2017-11-15T02:55:22.000Z","updated_at":"2023-05-01T00:32:48.000Z","dependencies_parsed_at":"2022-11-02T11:47:18.785Z","dependency_job_id":null,"html_url":"https://github.com/cdoco/ansi-styles","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Fansi-styles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Fansi-styles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Fansi-styles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdoco%2Fansi-styles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdoco","download_url":"https://codeload.github.com/cdoco/ansi-styles/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244722655,"owners_count":20499153,"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-colors","ansi-styles","console-color"],"created_at":"2024-11-26T07:11:52.847Z","updated_at":"2025-03-21T01:42:00.822Z","avatar_url":"https://github.com/cdoco.png","language":"PHP","readme":"# ansi-styles\n\n\u003e [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal\n\n![](screenshot.png)\n\n## Install\n\n```\n$ composer require cdoco/ansi-styles\n```\n\n## Usage\n\n```php\nrequire_once 'vendor/autoload.php';\n\n$style = new \\Cdoco\\AnsiStyles();\n\necho $style-\u003eblue-\u003eopen . 'Hello Word!' . PHP_EOL . $style-\u003eblue-\u003eclose;\n\necho $style-\u003ecolor-\u003ergb(100, 200, 15) . \"Hello Word!\" . PHP_EOL . $style-\u003ecolor-\u003eclose;\necho $style-\u003ecolor-\u003ehsl(120, 100, 60) . \"Hello Word!\" . PHP_EOL . $style-\u003ecolor-\u003eclose;\necho $style-\u003ecolor-\u003ehex('#C0FFEE') . \"Hello Word!\" . PHP_EOL . $style-\u003ecolor-\u003eclose;\n\necho $style-\u003ebgColor-\u003ergb(100, 200, 15) . \"Hello Word!\" . PHP_EOL . $style-\u003ebgColor-\u003eclose;\n```\n\n## API\n\nEach style has an `open` and `close` property.\n\n## Styles\n\n### Modifiers\n\n- `reset`\n- `bold`\n- `dim`\n- `italic` *(Not widely supported)*\n- `underline`\n- `inverse`\n- `hidden`\n- `strikethrough` *(Not widely supported)*\n\n### Colors\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `gray` (\"bright black\")\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- `bgBlackBright`\n- `bgRedBright`\n- `bgGreenBright`\n- `bgYellowBright`\n- `bgBlueBright`\n- `bgMagentaBright`\n- `bgCyanBright`\n- `bgWhiteBright`\n\n\n## Advanced usage\n\nBy default, you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.\n\n- `$style-\u003emodifier`\n- `$style-\u003ecolor`\n- `$style-\u003ebgColor`\n\n###### Example\n\n```php\necho $style-\u003ecolor-\u003egreen-\u003eopen;\n```\n\n## [256 / 16 million (TrueColor) support](https://gist.github.com/XVilka/8346728)\n\nTo use these, call the associated conversion function with the intended output, for example:\n\n```php\n$style-\u003ecolor-\u003ergb(100, 200, 15); // RGB to 16 color ansi foreground code\n$style-\u003ebgColor-\u003ergb(100, 200, 15); // RGB to 16 color ansi background code\n\n$style-\u003ecolor-\u003ehsl(120, 100, 60); // HSL to 256 color ansi foreground code\n$style-\u003ebgColor-\u003ehsl(120, 100, 60); // HSL to 256 color ansi foreground code\n\n$style-\u003ecolor-\u003ehex('#C0FFEE'); // Hex (RGB) to 16 million color foreground code\n$style-\u003ebgColor-\u003ehex('#C0FFEE'); // Hex (RGB) to 16 million color background code\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdoco%2Fansi-styles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdoco%2Fansi-styles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdoco%2Fansi-styles/lists"}