{"id":18015608,"url":"https://github.com/nomemory/ansiscape","last_synced_at":"2025-03-26T18:31:23.900Z","repository":{"id":82269811,"uuid":"109815037","full_name":"nomemory/ansiscape","owner":"nomemory","description":"Color your output using Ansi Escape codes","archived":false,"fork":false,"pushed_at":"2017-11-15T09:27:20.000Z","size":64,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T06:41:38.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/nomemory.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}},"created_at":"2017-11-07T09:35:51.000Z","updated_at":"2025-01-05T13:37:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc04e8b7-0522-48c0-bf88-bdad985cba4d","html_url":"https://github.com/nomemory/ansiscape","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/nomemory%2Fansiscape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fansiscape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fansiscape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fansiscape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomemory","download_url":"https://codeload.github.com/nomemory/ansiscape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245712680,"owners_count":20660279,"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-10-30T04:14:31.434Z","updated_at":"2025-03-26T18:31:23.891Z","avatar_url":"https://github.com/nomemory.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AnsiScape\n\n**AnsiScape** is a simple Java library that allows the user to format the output of the applications using [ANSI Escape Codes](https://en.wikipedia.org/wiki/ANSI_escape_code).\n\nLibrary is available in [jcenter()](https://bintray.com/nomemory/maven/ansiscape).\n\n**gradle:**\n\n```groovy\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'net.andreinc.ansiscape:ansiscape:0.0.2'\n}\n```\n\n**maven:**\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejcenter\u003c/id\u003e\n        \u003curl\u003ehttps://jcenter.bintray.com/\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003enet.andreinc.ansiscape\u003c/groupId\u003e\n  \u003cartifactId\u003eansiscape\u003c/artifactId\u003e\n  \u003cversion\u003e0.0.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Example (1)\n\n```java\nAnsiScape asciiScape = new AnsiScape();\n\nString formatted = asciiScape.format(\"{b Some Bold Text {u Also Underlined}}\");\nString formatted2 = asciiScape.format(\"Romanian Flag {redBg    }{yellowBg    }{blueBg    }\");\n\nSystem.out.println(formatted);\nSystem.out.println(formatted2);\n```\n\nThe output:\n\n![Example1Simple.png](https://github.com/nomemory/asciiscape/blob/master/examples/Example1Simple.png)\n\n### Example (2)\n\nIn this example we are defining our own escape codes classes (in a way similar to CSS classes):\n\n```java\nAnsiScapeContext context = new AnsiScapeContext();\n\n// Create new escape classes that can be used as tags inside the text\nAnsiClass title = AnsiClass.withName(\"title\").add(AnsiSequence.BOLD);\nAnsiClass url = AnsiClass.withName(\"url\").add(AnsiSequence.UNDERLINE, AnsiSequence.BLUE);\nAnsiClass text = AnsiClass.withName(\"text\").add(AnsiSequence.RED);\n\ncontext.add(title).add(url).add(text);\n\nAnsiScape ansiScape = new AnsiScape(context);\n\nString format = ansiScape.format(\"{title Bold title}\\n\" +\n                                                 \"-{text Some url: {url www.google.com}};\\n\" +\n                                                 \"-{text Some other url: {url {redBg www.redbackground.com}}}\");\n\nSystem.out.println(format);\n```\nThe output:\n\n![Example2Simple.png](https://github.com/nomemory/asciiscape/blob/master/examples/Example2Simple.png)\n\n### Supported classes\n\nBy default the following escape classes can be used:\n\n| Escape Class  |  Description |\n| ------------- | -------------|\n| `{b }` | Bold text |\n| `{bold }` | Bold text |\n| `{dim }` | Dim text |\n| `{u }` | Underlined text |\n| `{underline }` | Underlined text |\n| `{blink }` | Blink text |\n| `{reverse }` | Reverse text |\n| `{blank }` | Blank |\n| `{overstrike }` | Overstrike text |\n| `{reset }` | Resets everything inside tag |\n| `{black }` | Black foreground |\n| `{blackBg }` | Black background |\n| `{red }` | Red foreground |\n| `{redBg }` | Red foreground |\n| `{green }` | Green foreground |\n| `{greenBg }` | Green background |\n| `{yellow }` | Yellow foreground |\n| `{yellowBg }` | Yellow background |\n| `{blue }` | Blue foreground |\n| `{blueBg }` | Blue background |\n| `{magenta }` | Magenta foreground |\n| `{magentaBg }` | Magenta background |\n| `{cyan }` | Cyan foreground |\n| `{cyanBg }` | Cyan background |\n| `{white }` | White foreground |\n| `{whiteBg }` | White background |\n\n### Notes\n\n- Library woks well with Linux and Mac terminals. It wasn't tested on Windows, but as far as I know it won't work on Windows XP or older `cmd.exe` terminals without additional hacks ;\n- In this stage the library is **experimental** - there are no unit tests for the moment;\n- Some terminals (like IntelliJ Output Console) do not implement all the ascii codes. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fansiscape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomemory%2Fansiscape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fansiscape/lists"}