{"id":23268430,"url":"https://github.com/miqueas/ink","last_synced_at":"2025-07-09T20:03:34.673Z","repository":{"id":47134510,"uuid":"294538142","full_name":"Miqueas/Ink","owner":"Miqueas","description":"Colorize your Lua script output with a easy to use markup","archived":false,"fork":false,"pushed_at":"2024-02-05T00:53:48.000Z","size":60,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-05T01:43:31.699Z","etag":null,"topics":["cli","colors","lua","terminal"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Miqueas.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}},"created_at":"2020-09-10T22:40:16.000Z","updated_at":"2023-03-16T13:49:11.000Z","dependencies_parsed_at":"2024-02-05T01:42:47.142Z","dependency_job_id":"0f2fd1b5-e43d-4025-a13d-1f4a6e347709","html_url":"https://github.com/Miqueas/Ink","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miqueas%2FInk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miqueas%2FInk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miqueas%2FInk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Miqueas%2FInk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Miqueas","download_url":"https://codeload.github.com/Miqueas/Ink/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230471223,"owners_count":18231201,"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":["cli","colors","lua","terminal"],"created_at":"2024-12-19T17:18:36.831Z","updated_at":"2024-12-19T17:18:37.615Z","avatar_url":"https://github.com/Miqueas.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License][LicenseBadge]][licenseURL]\n\n¡Lee la versión en español [aquí](README_es.md)!\n\n# Ink\n\nColorize the output of your Lua scripts with Ink like:\n\n```lua\nlocal ink = require(\"Ink\")\nlocal my_string = \"Hello, #{FG(Green)}world!#{None}\"\n\nink:print(my_string)\n```\n\nAnd the output looks like this:\n\n![Capture 1](cap1.png)\n\nYou can form more complex outputs like this:\n\n```lua\nlocal ink = require(\"Ink\")\nlocal my_string = \"#{Bold}This#{None} #{Blink; Italic}is#{None} #{Reverse; FG(RGB(167, 110, 78))}a#{None} #{DobleU; Strike}more#{None} #{BG(146)}complex#{None} %s.\"\nlocal my_format = \"example\"\n\nink:print(my_string, my_format)\n```\n\nOutput:\n\n![Capture 2](cap2.png)\n\nThe word \"is\" has the \"Blink\" effect, so you can't see in the capture.\n\n### Usage\n\nUsing Ink is really simple, you only need put the output properties inside of `#{}`, separating each one using a semicolon (;) and Ink make the rest. Ink allow the following properties:\n\n  - \"Effects\":\n    * None (reset all properties)\n    * Bold\n    * Dim\n    * Italic\n    * Underline\n    * Blink\n    * Reverse\n    * Hidden\n    * Strike\n    * DobleU (\"Doble Underline\")\n  - Colors: you can use colors only with `FG()` (Foreground) and `BG()` (Background) functions.\n    * Black\n    * Red\n    * Green\n    * Yellow\n    * Blue\n    * Magenta\n    * Cyan\n    * White\n\n`FG()` and `BG()` functions take 3 types of arguments and only 1 of each it:\n  1. A predefined color (one of you see in the above list). [Read this][1]\n  2. A number from 0 to 255. [Read this][2]\n  3. A RGB value using the `RGB()` function. [Read this][3]\n\nInk is case-sensitive. Ink know that `FG` is a function for foreground colors, but `fg` is another thing. Also, Ink provide 2 functions/methods:\n\n  1. `compile()`: takes an string, convert all `#{}` groups into a ANSI escape code and returns the result string.\n  2. `print(...)`: takes an string, formats it with the rest of arguments, passes it to `compile()` and prints it directly.\n\nOf course, if you want to use manually ANSI codes, Ink provide:\n\n  - `Ink.Cache`: For internal purposes, contains the cached strings.\n  - `Ink.DisableCache`: Disables the caching if `true`, `false` by default.\n  - `Ink.ESC`: The character for colored output (`0x1b`).\n  - `Ink.Attr`: Maybe the name is not correct, but basically contains the number code for output \"effects\".\n  - `Ink.FG`: Contains predefined colors (see the first list). You can use it like:\n    ```lua\n    local ink = require(\"Ink\")\n    local my_string = ink.ESC .. \"[\" .. ink.FG.Green .. \"mTesting!\" .. ink.ESC .. \"[\" .. ink.Attr.None\n    print(my_string)\n    ```\n  - `Ink.BG`: same as `FG` but for background colors.\n\n__Is very important to separate properties with a semicolon (please read \"Limitations\" below).__\n\n### Limitations\n\nIf you don't use semicolons properly, the output maybe wrong because the code behinds Ink is actually simple and don't check this details. The same case if for when you put various semicolons with no properties between each one. Maybe there's others limitations, but I only know these.\n\nOf course, this things are in \"TODO\" and I want to improve this library.\n\n### Sources\n\nI made this using the info provide by Wikipedia in [this article][4]\n\n[1]: https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit\n[2]: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit\n[3]: https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit\n[4]: https://en.wikipedia.org/wiki/ANSI_escape_code\n[LicenseBadge]: https://img.shields.io/badge/License-Zlib-brightgreen?style=for-the-badge\n[LicenseURL]: https://opensource.org/licenses/Zlib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiqueas%2Fink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiqueas%2Fink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiqueas%2Fink/lists"}