{"id":28098515,"url":"https://github.com/pmonks/jansi-clj","last_synced_at":"2025-10-12T00:34:20.866Z","repository":{"id":148948980,"uuid":"61403524","full_name":"pmonks/jansi-clj","owner":"pmonks","description":"Clojure Wrapper around Jansi (Terminal Colors, Cursor Movement, ...), even for Windows.","archived":false,"fork":false,"pushed_at":"2025-04-09T20:59:16.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T18:01:40.576Z","etag":null,"topics":["ansi","ansi-colors","clojure","command-line","terminal"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"xsc/jansi-clj","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmonks.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,"zenodo":null}},"created_at":"2016-06-17T21:32:42.000Z","updated_at":"2025-04-09T20:59:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"bae60dec-a374-48cb-9854-f329a7d0f6f5","html_url":"https://github.com/pmonks/jansi-clj","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pmonks/jansi-clj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmonks%2Fjansi-clj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmonks%2Fjansi-clj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmonks%2Fjansi-clj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmonks%2Fjansi-clj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmonks","download_url":"https://codeload.github.com/pmonks/jansi-clj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmonks%2Fjansi-clj/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009512,"owners_count":26084609,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","ansi-colors","clojure","command-line","terminal"],"created_at":"2025-05-13T17:57:57.071Z","updated_at":"2025-10-12T00:34:20.859Z","avatar_url":"https://github.com/pmonks.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!WARNING]\n\u003e This is a fork of Yannick Scherer's original GitHub project, [which has been migrated to codeberg](https://codeberg.org/xsc/jansi-clj).  That is the original / canonical version and this (orphaned) fork will likely be deleted at some point.\n\n# jansi-clj\n\n__jansi-clj__ is a Clojure wrapper around [jansi](https://github.com/fusesource/jansi), a\nlibrary that handles ANSI escape sequences (e.g. for terminal colors, cursor movement, ...)\non a per-OS basis, proclaiming that it _\"even works on windows\"_.\n\n[![Clojars Project](https://img.shields.io/clojars/v/jansi-clj.svg)](https://clojars.org/jansi-clj)\n[![Documentation](https://cljdoc.org/badge/jansi-clj/jansi-clj)](https://cljdoc.org/d/jansi-clj/jansi-clj/CURRENT)\n[![CI](https://github.com/xsc/jansi-clj/workflows/CI/badge.svg)](https://github.com/xsc/jansi-clj/actions?query=workflow%3ACI)\n\nThis library provides a dead-simple way of enabling ANSI support for all terminal emulators supported by\njansi, as well as functions to produce those ANSI sequences.\n\n## Auto-Enable ANSI Codes\n\nIf you need ANSI support for different platforms but don't want to replace the code that actually generates\nthe escape sequences, just require the namespace `jansi-clj.auto`.\n\n```clojure\n(require 'jansi-clj.auto)\n```\n\nThat's it. The standard output streams (as well as Clojure's `*out*` and `*err*` writers) will be wrapped\nin a platform-/terminal-specific way to provide correct handling of ANSI codes. This means that you can\nmake any such console output portable without having to touch any existing code.\n\n__Note:__ Wrapping the streams currently seems not to work correctly when done within a JVM spun up by Leiningen\nsince stdout/stderr are then redirected and Jansi cannot detect that there is a color-enabled terminal at their\nends. __This means that escape sequences will be filtered out when produced within `lein repl` or `lein run`.__\n(`lein trampoline run` and executing an ubjerar should work, though.)\n\nThe choice of which colorization library to use is completely yours. But since you're already here...\n\n## Formatting Terminal Output\n\n```clojure\n(require '[jansi-clj.core :refer :all])\n```\n\n### Colors\n\n```clojure\n(colors)\n;; =\u003e (:black :default :magenta :white :red :blue :green :yellow :cyan)\n```\n\nFor each color, there exist four functions, e.g. `red` (create a string with red foreground), `red-bright`\n(create a string with bright red foreground), as well as `red-bg` (red background) and `red-bg-bright`.\n\n```clojure\n(println \"ERROR:\" (red \"This\" \" is \" \"a message.\"))\n;; ERROR: This is a message.\n;; =\u003e nil\n```\n\nAs you can see, the functions behave like `str` regarding the concatenation of the parts.\n\n### Attributes\n\n```clojure\n(attributes)\n;; =\u003e (:underline-double :no-negative :no-underline :blink-fast :no-strikethrough\n;;     :conceal :negative :no-italic :italic :faint :no-conceal :no-bold :no-blink\n;;     :strikethrough :blink-slow :bold :underline)\n```\n\nFor each of these keywords there exists a respective function that provides the desired formatting.\n\n```clojure\n(println (bold (red \"ERROR\")))\n;; ERROR\n;; =\u003e nil\n```\n\n### `render`\n\nJansi offers a special render syntax that can be used via `jansi-clj.core/render`:\n\n```clojure\n;; syntax: \"@|code(,code)* text|@\"\n(render \"@|green,bold Success!|@ (Code: 0)\")\n```\n\nThere is `renderf` that accepts a format string as its first parameter:\n\n```clojure\n(renderf \"@|green,bold %s|@ (Code: %d)\" \"Sucess!\" 0)\n```\n\n### Others\n\nThere is a variety of other functions that can be used. Please refer to the\n[auto-generated documentation](https://cljdoc.org/d/jansi-clj/jansi-clj/CURRENT).\n\n## Globally enable/disable ANSI Codes\n\nThe two functions `jansi-clj.core/enable!` and `jansi-clj.core/disable!` can be used to prevent the\ndifferent escape sequences from showing up in the generated strings in the first place.\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2021-2023 Yannick Scherer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmonks%2Fjansi-clj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmonks%2Fjansi-clj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmonks%2Fjansi-clj/lists"}