{"id":13485490,"url":"https://github.com/fusesource/jansi","last_synced_at":"2025-05-13T20:08:15.010Z","repository":{"id":655647,"uuid":"298328","full_name":"fusesource/jansi","owner":"fusesource","description":"Jansi is a small java library that allows you to use ANSI escape sequences to format your console output which works even on windows. ","archived":false,"fork":false,"pushed_at":"2025-05-07T07:36:20.000Z","size":2496,"stargazers_count":1151,"open_issues_count":36,"forks_count":145,"subscribers_count":33,"default_branch":"master","last_synced_at":"2025-05-07T08:32:53.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://fusesource.github.io/jansi/","language":"Java","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/fusesource.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"license.txt","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":"2009-09-05T10:10:52.000Z","updated_at":"2025-05-07T07:36:07.000Z","dependencies_parsed_at":"2023-10-12T17:50:24.014Z","dependency_job_id":"3e94ac1e-6342-4d8e-abc9-4dc5afccc4f1","html_url":"https://github.com/fusesource/jansi","commit_stats":{"total_commits":448,"total_committers":47,"mean_commits":9.53191489361702,"dds":0.6808035714285714,"last_synced_commit":"045fd560a7580713d910aecaf776e0b3328c27be"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusesource%2Fjansi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusesource%2Fjansi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusesource%2Fjansi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fusesource%2Fjansi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fusesource","download_url":"https://codeload.github.com/fusesource/jansi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020484,"owners_count":22000750,"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-07-31T18:00:24.346Z","updated_at":"2025-05-13T20:08:14.960Z","avatar_url":"https://github.com/fusesource.png","language":"Java","readme":"# [![Jansi][logo]][Jansi]\n[logo]: http://fusesource.github.io/jansi/images/project-logo.png \"Jansi\"\n\n## Description\n\n[Jansi][Jansi] is a small java library that allows you to use [ANSI escape\ncodes][ansi] to format your console output which works even on Windows.\n\nIt also provides the required JNI libraries:\n- [Kernel32](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/Kernel32.html) and [WindowsSupport](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/WindowsSupport.html) for ANSI support on Windows\n- [CLibrary](http://fusesource.github.io/jansi/documentation/native-api/org/fusesource/jansi/internal/CLibrary.html) for POSIX tty functions on Unix and Windows\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.fusesource.jansi/jansi.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.fusesource.jansi/jansi)\n\n[Jansi]: http://fusesource.github.io/jansi/\n[ansi]: http://en.wikipedia.org/wiki/ANSI_escape_code \"Wikipedia\"\n\n## Features\n\n* Implements ANSI escape colorization/handling that is missing on the Windows\n  platform, using integrated JNI library.\n* Strips ANSI escape codes if process output is is being redirected and not\n  attached to a terminal.\n* Easy to use Ansi escape sequence builder API.\n* JNI access to low-level console features.\n\n## Synopsis\n\nMost unix terminals support rendering ANSI escape codes when Java sends them\nvia `System.out`, but when this is done on Windows, they don't get interpreted\nand you get garbage on the console.\n\nFurthermore, even when on Unix, when process output is being redirected to a\nfile, you typically don't want to output escape codes to the file since most\nfile viewers and editors will not properly display the escape codes.\n\nJansi detects and abstracts the ANSI support provided by the attached\nterminal. When your Java application uses Jansi, it can always assume that\nstandard out and error streams support ANSI sequences. Depending on the\nplatform and if the application output is attached to a real terminal, Jansi\nwill do one of the following with the ANSI escape codes that it receives:\n\n* Pass them through untouched\n* Filter them out\n* Use platform specific APIs to implement the terminal commands represented by\n  the escape sequence\n\n## Example Usage\n\nEnabling the Jansi ANSI support into your application is as simple as doing a\nsimple static method call:\n\n``` java\nimport org.fusesource.jansi.AnsiConsole;\n...\nAnsiConsole.systemInstall();\n```\n\nDisabling it is also done via a static method:\n\n``` java\nAnsiConsole.systemUninstall();\n```\n\nIt is safe to call those methods multiple times, they keep track of how many\ntimes `systemInstall()` has been called and only uninstalls when the\n`systemUninstall()` method is called a corresponding number of times.\n\nUsing the Ansi escape sequence builder:\n\n```java\nimport static org.fusesource.jansi.Ansi.*;\nimport static org.fusesource.jansi.Ansi.Color.*;\n...\nSystem.out.println( ansi().eraseScreen().fg(RED).a(\"Hello\").fg(GREEN).a(\" World\").reset() );\n```\n\nThe above will clear the screen, write `Hello` in red and `World` in green,\nthen reset the color attributes so that subsequent data printed to the stream\nuses the default colors.\n\nBut there is an even simpler way to accomplish the above using the `render`\nmethod:\n\n```java\nSystem.out.println( ansi().eraseScreen().render(\"@|red Hello|@ @|green World|@\") );\n```\n\n\n## Project Links\n\n* [Project Home](http://fusesource.github.io/jansi)\n* [Release Downloads](http://fusesource.github.io/jansi/download.html)\n* [GitHub](https://github.com/fusesource/jansi)\n* [Issue Tracker](https://github.com/fusesource/jansi/issues)\n","funding_links":[],"categories":["Projects","Java ☕","项目"],"sub_categories":["CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusesource%2Fjansi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffusesource%2Fjansi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffusesource%2Fjansi/lists"}