2022-03-24 23:55:37 +00:00
|
|
|
## JColorfulConsole
|
|
|
|
|
|
|
|
### JColorfulConsole is a console color library.
|
2022-03-25 16:06:42 +00:00
|
|
|
[![](https://jitpack.io/v/Anas-Elgarhy/JColorfulConsole.svg)](https://jitpack.io/#Anas-Elgarhy/JColorfulConsole)
|
2022-03-24 23:55:37 +00:00
|
|
|
|
|
|
|
### Features:
|
|
|
|
- Support text color.
|
|
|
|
- Support background color.
|
|
|
|
- Support text style.
|
|
|
|
|
2022-03-25 16:03:45 +00:00
|
|
|
### How to add this library into your project
|
2022-03-25 18:56:49 +00:00
|
|
|
**Step 1**. Add the dependency
|
2022-03-25 16:03:45 +00:00
|
|
|
```xml
|
2022-03-25 18:56:49 +00:00
|
|
|
<dependency>
|
|
|
|
<groupId>com.anas.jcolorfulconsole</groupId>
|
|
|
|
<artifactId>jcolorfulconsole</artifactId>
|
2022-03-25 18:59:21 +00:00
|
|
|
<version>0.1.5</version>
|
2022-03-25 18:56:49 +00:00
|
|
|
</dependency>
|
2022-03-25 16:03:45 +00:00
|
|
|
```
|
2022-03-25 18:56:49 +00:00
|
|
|
**Step 2**. run this command `mvn install`
|
2022-03-25 16:03:45 +00:00
|
|
|
|
|
|
|
#### Gradle:
|
|
|
|
**Step 1**. Add the JitPack repository to your build file<br>
|
|
|
|
*Add it in your root build.gradle at the end of repositories:*
|
|
|
|
```gradle
|
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
...
|
|
|
|
maven { url 'https://jitpack.io' }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
**Step 2**. Add the dependency
|
|
|
|
```gradle
|
|
|
|
dependencies {
|
2022-03-25 18:59:21 +00:00
|
|
|
implementation 'com.github.Anas-Elgarhy:JColorfulConsole:0.1.5'
|
2022-03-25 16:03:45 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-03-24 23:55:37 +00:00
|
|
|
### Usage:
|
|
|
|
```java
|
2022-03-25 15:14:38 +00:00
|
|
|
ConsoleManager manager = new DefaultConsoleManager(); // Create a new console manager
|
|
|
|
manager.setTextColor(TextColor.LIGHT_RED); // Set text color
|
|
|
|
manager.setBackgroundColor(BackgroundColor.DARK_BLUE); // Set background color
|
2022-03-24 23:55:37 +00:00
|
|
|
|
2022-03-25 15:14:38 +00:00
|
|
|
manager.println("Hello World!"); // Print text
|
|
|
|
```
|
|
|
|
<img src="./Screenshots/1.png">
|
|
|
|
|
|
|
|
```java
|
|
|
|
ConsoleManager manager = new DefaultConsoleManager(); // Create a new console manager
|
|
|
|
manager.setTextColor(TextColor.LIGHT_RED); // Set text color
|
|
|
|
manager.setBackgroundColor(BackgroundColor.DARK_BLUE); // Set background color
|
|
|
|
manager.setTextStyle(TextStyle.ITALIC); // Set text style
|
|
|
|
|
|
|
|
manager.println("Hello World!"); // Print text
|
|
|
|
```
|
|
|
|
<img src="./Screenshots/2.png">
|
|
|
|
|
|
|
|
```java
|
|
|
|
public class Example1 {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
ConsoleManager manager = new DefaultConsoleManager();
|
|
|
|
|
|
|
|
manager.print("Hello", BackgroundColor.DARK_YELLOW, TextColor.DARK_WHITE, TextStyle.BOLD, TextStyle.ITALIC);
|
|
|
|
manager.print(", ", TextColor.LIGHT_GREEN);
|
|
|
|
manager.print("I'm ", TextColor.DARK_YELLOW);
|
|
|
|
manager.print("Anas", TextColor.LIGHT_BLUE, TextStyle.DOUBLE_UNDERLINE);
|
|
|
|
manager.println(" :D", TextColor.LIGHT_CYAN);
|
|
|
|
manager.println("\tFrom", TextColor.LIGHT_RED, TextStyle.ITALIC);
|
|
|
|
manager.print("Eg", BackgroundColor.LIGHT_RED);
|
|
|
|
manager.print("y", BackgroundColor.DARK_WHITE);
|
|
|
|
manager.print("pt", BackgroundColor.DARK_BLACK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2022-03-25 17:25:08 +00:00
|
|
|
<img src="./Screenshots/3.png">
|
|
|
|
|
2022-03-25 17:26:21 +00:00
|
|
|
#### License: MIT
|