{"id":15284310,"url":"https://github.com/didas-git/tasai","last_synced_at":"2025-04-12T23:21:47.402Z","repository":{"id":214699402,"uuid":"737154216","full_name":"Didas-git/tasai","owner":"Didas-git","description":"The most complete and flexible ansi coloring library","archived":false,"fork":false,"pushed_at":"2024-03-08T00:32:02.000Z","size":88,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T17:21:22.266Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Didas-git.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}},"created_at":"2023-12-30T02:05:41.000Z","updated_at":"2024-11-19T21:20:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"fa3495b0-1881-4c82-b96b-81a74118649a","html_url":"https://github.com/Didas-git/tasai","commit_stats":null,"previous_names":["didas-git/tasai"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Didas-git%2Ftasai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Didas-git%2Ftasai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Didas-git%2Ftasai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Didas-git%2Ftasai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Didas-git","download_url":"https://codeload.github.com/Didas-git/tasai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248644181,"owners_count":21138564,"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":[],"created_at":"2024-09-30T14:53:13.626Z","updated_at":"2025-04-12T23:21:47.383Z","avatar_url":"https://github.com/Didas-git.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tasai\n\nThe most complete and flexible ansi coloring library.\n\n## Why Tasai?\n\nTasai is the fastest full feature, dependency free terminal styling library.\n\n- 4 different apis (includes drop in replacement for chalk)\n- Support for bun macros\n- No prototype pollution\n- Support for nested colors and **doesn't** have the nested styling bug other libraries have.\n- *Dependency free*\n\n## Usage\n\n### Chalk Drop-in Replacement\n\n```ts\nimport { c } from \"tasai\";\n\nconsole.log(c.blue('Hello world!'));\n```\n\n### Macro API\n\nThe macro api is all string based and was made during a fun discussing with @paperdave.\n\nThere are 3 different macros named according to the range of colors they support.\n\n- 4bit - The 16 colors we are all used to.\n- 8bit - 256 colors and 4bit colors.\n- 24bit - All the rgb colors (and different color spaces), 8bit, and 4bit colors.\n\n#### Usage\n\nYou need bun to use macros.\n\nTo mark a color you start with `\u003ccolor\u003e` and to tell where it ends you terminate with `\u003cr\u003e`.\nThe macro will try to get the closest `r` terminator but if it encounters a color it will expand.\n\n##### 4Bit\n\n```ts\nimport { parseUsing4BitColors } from \"tasai\" with { type: \"macro\" };\n\nconsole.log(parseUsing4BitColors(\"\u003cbg_black\u003eHello \u003ccyan\u003eWorld\u003cr\u003e!\u003cr\u003e\"));\n```\n\n##### 8Bit\n\n```ts\nimport { parseUsing8BitColors } from \"tasai\" with { type: \"macro\" };\n\nconsole.log(parseUsing8BitColors(\"\u003cbg_0\u003eHello \u003c14\u003eWorld\u003cr\u003e!\u003cr\u003e\"));\n```\n\n##### 24Bit\n\n```ts\nimport { parseUsing24BitColors } from \"tasai\" with { type: \"macro\" };\n\nconsole.log(parseUsing8BitColors(\"\u003cbg_#00000\u003eHello \u003c0,255,255\u003eWorld\u003cr\u003e\u003chsl,0.1,1,0.5\u003e!\u003cr\u003e\u003cr\u003e\"));\n```\n\n### Tasai API\n\nWhile tasai's api might be similar to chalk at a glance, it does not support calling the color methods.\nYou are required to either compile the methods into functions or call the other helpers.\n\n```ts\nimport { t } from \"tasai\";\n\nconst red = t.from8Bit(1).toFunction();\nconst blue = t.fromHex(\"#0000FF\").toFunction();\nconst orange = t.fromColor(Color.fromHSL(0.1, 1, 0.5)).toFunction();\nconst italicUnderlineGreenBG = t.italic.underline.brightGreen.toFunction();\n\nconsole.log(none(\"This is a really long test\"));\nconsole.log(red(\"This is a really long test\"));\nconsole.log(blue(\"This is a really long test\"));\nconsole.log(orange(\"This is a really long test\"));\nconsole.log(italicUnderlineGreenBG(\"This is a really long test\"));\nconsole.log(t.doubleUnderline.brightMagenta.colorize(\"This is a really long test\"));\nconsole.log(t.gradient(\"This is a really long test\", Tasai.ICE_GRADIENT));\nconsole.log(t.gradient(\"This is a really long test\", Tasai.REVERSED_ICE_GRADIENT));\nconsole.log(t.gradient(\"This is a really long test\", Tasai.FIRE_GRADIENT));\nconsole.log(t.gradient(\"This is a really long test\", Tasai.REVERSED_FIRE_GRADIENT));\nconsole.log(t.gradient(\"This is a really long test\", Tasai.RAINBOW_GRADIENT));\nconsole.log(t.inverse.gradient(\"This is a really long test\", Tasai.RAINBOW_GRADIENT));\n// Sets the gradient to be background but unlike `inverse` it doesn't swap the foreground color\nconsole.log(t.gradient(\"This is a really long test\", Tasai.RAINBOW_GRADIENT, true));\nconsole.log(t.zebra(\"This is a really long test\"));\nconsole.log(t.bgBlue.zebra(\"This is a really long test\"));\nconsole.log(t.cyclic(\"This is a really long test\", 2, [Color.AQUA, Color.PLUM]));\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidas-git%2Ftasai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdidas-git%2Ftasai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdidas-git%2Ftasai/lists"}