Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shuoros/jterminal
A library for printing custom outputs in terminal for Java
https://github.com/shuoros/jterminal
colors java print terminal
Last synced: about 5 hours ago
JSON representation
A library for printing custom outputs in terminal for Java
- Host: GitHub
- URL: https://github.com/shuoros/jterminal
- Owner: shuoros
- License: mit
- Created: 2021-10-30T09:06:44.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-13T15:04:14.000Z (about 3 years ago)
- Last Synced: 2023-07-28T10:11:00.406Z (over 1 year ago)
- Topics: colors, java, print, terminal
- Language: Java
- Homepage: https://shuoros.github.io/jterminal
- Size: 447 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
JTerminal
Is an easy to use library for printing custom outouts on terminal!
If you like this project, help me by giving me a star =))<3
## What is in V1.0.2
- Print and println with foreground and background color.
- Support 8-bit 0-255 XTerm colors.
- Get colors by name and theire XTerm code.
- TextEntity class for assign different styles to a single string.
- Pass your TextEntity list with no order and full coverage (v1.0.2)
- clear the terminal.
- delete lines.## Hello Terminal
To use JTerminal you just need to make a static call to your desired API.For example:
![ezgif com-gif-maker](https://user-images.githubusercontent.com/45015114/140813186-1326fb9b-decc-4182-bf3c-19a4b0e04c24.gif)
The above gif was the result of running this piece of code:
```java
import java.util.List;import io.github.shuoros.jterminal.JTerminal;
import io.github.shuoros.jterminal.ansi.Color;
import io.github.shuoros.jterminal.util.TextEntity;public class Main {
public static void main(String[] args) {
// Clear screen with timer
JTerminal.println("Screen must clear after one second");
JTerminal.clear(1000);// Delete line
JTerminal.println("The line below must be deleted after one second");
JTerminal.println("I should be deleted in a second");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
JTerminal.delete();
JTerminal.clear(1000);
// Print with default foreground and background colors
JTerminal.println("Hello I'm in your terminal's default foreground and background color");
JTerminal.println("\n");// Print with foreground or background color
JTerminal.println("I'm an orange text with default background", Color.ORANGE);
JTerminal.println("I'm an orange text with white background", Color.ORANGE, Color.WHITE);
JTerminal.println("\n");// Use custom XTerm code
JTerminal.println("I'm printed with 201 XTerm code", Color.xTerm(201));
JTerminal.println("\n");// Print with TextEntity
JTerminal.println("My colors were set with TextEntity", List.of(//
new TextEntity(0, 24, Color.BLUE), //
new TextEntity(24, 33, Color.YELLOW, Color.RED)));
JTerminal.println("\n");// All suppoerted XTerm colors (8-bit 0-255)
JTerminal.println("All suppoerted XTerm colors (8-bit 0-255) ->", List.of(//
new TextEntity(0, 27, Color.WHITE), //
new TextEntity(27, 42, Color.RED), //
new TextEntity(42, 44, Color.WHITE, Color.ORANGE)));
JTerminal.println("");
for (Color color : Color.values()) {
JTerminal.print(color.toString(), color);
JTerminal.print(" ");
}
JTerminal.println("\n");// Credits
JTerminal.println(">JTerminal:~ 1.0.0", List.of(//
new TextEntity(0, 1, Color.DARK_SEA_GREEN_7), //
new TextEntity(1, 10, Color.ORANGE), //
new TextEntity(10, 12, Color.DARK_SEA_GREEN_7), //
new TextEntity(12, 18, Color.WHITE)));
JTerminal.println("By Soroush Shemshadi", Color.ORANGE);
}}
```#### To see color cheat sheet please check [docs](https://github.com/shuoros/JTerminal/blob/main/doc).
## Installation
You can use **JTerminal** with any project management tool:### Maven
```xml
io.github.shuoros
JTerminal
1.0.2```
### Gradle
```gradle
// https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
implementation group: 'io.github.shuoros', name: 'JTerminal', version: '1.0.2'
```
Or```gradle
// https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
implementation 'io.github.shuoros:JTerminal:1.0.2'
```And in **Kotlin**
```gradle
// https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
implementation("io.github.shuoros:JTerminal:1.0.2")
```### SBT
```sbt
// https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
libraryDependencies += "io.github.shuoros" % "JTerminal" % "1.0.2"
```### Ivy
```xml
```
### Grape
```java
// https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
@Grapes(
@Grab(group='io.github.shuoros', module='JTerminal', version='1.0.2')
)
```### Leiningen
```clj
;; https://mvnrepository.com/artifact/io.github.shuoros/JTerminal
[io.github.shuoros/JTerminal "1.0.2"]
```## Authors
JTerminal is developed by [Soroush Shemshadi](https://github.com/shuoros) and [contributors](https://github.com/shuoros/JTerminal/blob/main/CONTRIBUTORS.md).## Contribution
If you want to contribute on this project, Please read the [contribution guide](https://github.com/shuoros/JTerminal/blob/main/CONTRIBUTE.md).## Releases
To see the changes in different versions of JTerminal, you can read the [release notes](https://github.com/shuoros/JTerminal/blob/main/RELEASENOTES.md).## Issues
If you encounter a bug or vulnerability, please read the [issue policy](https://github.com/shuoros/JTerminal/blob/main/ISSUES.md).## Documentation
To learn how to work with JTerminal, please take a look at the [/doc](https://github.com/shuoros/JTerminal/tree/main/doc) folder.## Acknowledgement
A greate thanks to [@sarahrajabi](https://github.com/sarahrajabi) for designing the logo.