{"id":28555297,"url":"https://github.com/polyseam/emoji-ansi-colorizer","last_synced_at":"2025-07-05T17:30:39.886Z","repository":{"id":297693406,"uuid":"996547076","full_name":"polyseam/emoji-ansi-colorizer","owner":"polyseam","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-06T21:05:55.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-06T22:19:43.557Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polyseam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-05T05:31:23.000Z","updated_at":"2025-06-06T21:05:57.000Z","dependencies_parsed_at":"2025-06-06T22:19:45.526Z","dependency_job_id":"c9a7e26d-0a48-4e4c-8a89-20c8d4ed6ca4","html_url":"https://github.com/polyseam/emoji-ansi-colorizer","commit_stats":null,"previous_names":["polyseam/emoji-ansi-colorizer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/polyseam/emoji-ansi-colorizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyseam%2Femoji-ansi-colorizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyseam%2Femoji-ansi-colorizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyseam%2Femoji-ansi-colorizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyseam%2Femoji-ansi-colorizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polyseam","download_url":"https://codeload.github.com/polyseam/emoji-ansi-colorizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyseam%2Femoji-ansi-colorizer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263778254,"owners_count":23509961,"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":"2025-06-10T06:05:54.741Z","updated_at":"2025-07-05T17:30:39.879Z","avatar_url":"https://github.com/polyseam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @polyseam/emoji-ansi-colorizer\n\nA minimal TypeScript/JavaScript library that converts emoji-wrapped tags into\nANSI escape codes for colorful terminal output. The core export is the\n`colorize` function—everything else is provided for convenience and discovery.\n\n---\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Basic Example](#basic-example)\n  - [Nested Styles](#nested-styles)\n  - [Control Characters](#control-characters)\n- [API Reference](#api-reference)\n- [Supported Emoji Tags](#supported-emoji-tags)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Overview\n\nUse intuitive emoji markers (e.g. `\u003c🔴\u003e…\u003c/🔴\u003e`) to wrap text, and let `colorize`\ntranslate them into proper ANSI codes. This makes it easy to add colors, bold,\nintensity, or underline to terminal output without memorizing escape sequences.\n\n```ts\nimport { colorize } from \"@polyseam/emoji-ansi-colorizer\";\n\nconsole.log(colorize(\"Server started at \u003c🟢\u003ePort 8080\u003c/🟢\u003e\"));\n```\n\nAll other constants (emoji names and the emoji-to-ANSI mapping) are exported\nprimarily so you can inspect or discover available tags, but they are not\nrequired to use the library. Your code will usually just call `colorize(...)`.\n\n---\n\n## Installation\n\n```sh\nnpm install @polyseam/emoji-ansi-colorizer\n# or if using Deno (import directly)\nimport { colorize } from \"jsr:@polyseam/emoji-ansi-colorizer\";\n```\n\n---\n\n## Usage\n\n### Basic Example\n\nWrap any substring with an opening and closing emoji tag. The `colorize`\nfunction finds these tags and replaces them with their ANSI codes:\n\n```ts\nimport { colorize } from \"@polyseam/emoji-ansi-colorizer\";\n\nconst msg = \"Warning: \u003c🔴\u003eDisk space low\u003c/🔴\u003e\";\nconsole.log(colorize(msg));\n// In a terminal, “Disk space low” appears in red.\n```\n\n### Nested Styles\n\nYou can nest tags. When an inner tag closes (which implicitly sends a full\nreset), the parent’s style is reapplied automatically:\n\n```ts\nimport { colorize } from \"@polyseam/emoji-ansi-colorizer\";\n\nconst nestedExample = colorize(\n  `\u003c🔴\u003eError: \u003c🔵\u003eCode 500\u003c/🔵\u003e encountered\u003c/🔴\u003e`,\n);\nconsole.log(nestedExample);\n// 1. Apply red → “Error: ”\n// 2. Apply blue → “Code 500”\n// 3. RESET → reapply red → “ encountered”\n// 4. RESET\n```\n\n### Control Characters\n\nIn addition to color tags, there are standalone emoji tags for:\n\n- **Bold** (🧱)\n- **High Intensity (Bright)** (✨)\n- **Underline** (⚓️)\n\n```ts\nimport { colorize } from \"@polyseam/emoji-ansi-colorizer\";\n\nconsole.log(colorize(`\u003c🧱\u003eImportant\u003c/🧱\u003e`));\n// → “Important” in bold\n\nconsole.log(colorize(`and \u003c⚓️\u003eDon't Forget\u003c/⚓️\u003e to save your work!`));\n// → “Don't Forget” underlined\n\nconsole.log(colorize(`\u003c✨\u003eNotice\u003c/✨\u003e the beauty`));\n// → “Notice” in bright (high intensity) style\n```\n\n---\n\n## API Reference\n\n### `colorize(input: string): string`\n\nThe single-function entry point. Parses the input string for emoji-based\nopen/close tags and emits a string with proper ANSI escape codes.\n\n**Parameters**:\n\n- `input` (`string`): A string containing zero or more emoji-wrapped segments.\\\n  Example: `\"Hello \u003c🔵\u003eworld\u003c/🔵\u003e!\"`.\n\n**Returns**:\n\n- (`string`): The same text, but with all recognized emoji tags replaced by\n  their ANSI codes, with nested styles preserved.\n\n---\n\n## Supported Emoji Tags\n\n| Emoji |       Description       |  ANSI Code   |\n| :---: | :---------------------: | :----------: |\n|  ⚫   |          Black          |  `\\x1b[30m`  |\n|  🔴   |           Red           |  `\\x1b[31m`  |\n|  🟢   |          Green          |  `\\x1b[32m`  |\n|  🟡   |         Yellow          |  `\\x1b[33m`  |\n|  🔵   |          Blue           |  `\\x1b[34m`  |\n|  🟣   |         Magenta         |  `\\x1b[35m`  |\n|  🥶   |          Cyan           |  `\\x1b[36m`  |\n|  ⚪   |          White          |  `\\x1b[37m`  |\n|  ⬛️   |      Black (bold)       | `\\x1b[1;30m` |\n|  🟥   |       Red (bold)        | `\\x1b[1;31m` |\n|  🟩   |      Green (bold)       | `\\x1b[1;32m` |\n|  🟨   |      Yellow (bold)      | `\\x1b[1;33m` |\n|  🟦   |       Blue (bold)       | `\\x1b[1;34m` |\n|  🟪   |     Magenta (bold)      | `\\x1b[1;35m` |\n|  🧊   |       Cyan (bold)       | `\\x1b[1;36m` |\n|  ⬜️   |      White (bold)       | `\\x1b[1;37m` |\n|  🧱   |          Bold           |  `\\x1b[1m`   |\n|  ✨   | High Intensity (Bright) |  `\\x1b[1m`   |\n|  ⚓️   |        Underline        |  `\\x1b[4m`   |\n\n_(See the full list in source code.)_\n\n---\n\n## Testing\n\nUnit tests use Deno’s built-in test runner. To run:\n\n```sh\ndeno test --allow-read\n```\n\nYou’ll see tests that verify:\n\n1. Plain text remains unchanged.\n2. Single emoji tags wrap text correctly.\n3. Nested tags reapply parent styles.\n4. Control-character tags (bold, underline, intensity) behave as expected.\n5. Unknown tags are rendered literally.\n\n---\n\n## Contributing\n\nContributions are welcome—especially around the `colorize` function’s parsing\nlogic or adding new emoji-to-ANSI mappings.\n\n1. Fork the repo.\n2. Create a feature branch:\n   ```sh\n   git checkout -b feature/your-descriptor\n   ```\n3. Implement or update code, add tests as needed.\n4. Run tests:\n   ```sh\n   deno test --allow-read\n   ```\n5. Commit \u0026 push.\n6. Open a Pull Request against `main`.\n\n---\n\n## License\n\n[Apache-2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyseam%2Femoji-ansi-colorizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyseam%2Femoji-ansi-colorizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyseam%2Femoji-ansi-colorizer/lists"}