mirror of
https://github.com/anas-elgarhy/JColorfulConsole.git
synced 2024-08-14 23:57:19 +00:00
27 lines
1.1 KiB
Java
27 lines
1.1 KiB
Java
|
package test;
|
||
|
|
||
|
import com.anas.jcolorfulconsole.ColoredString;
|
||
|
import com.anas.jcolorfulconsole.TextStyle;
|
||
|
import com.anas.jcolorfulconsole.lanterna.TextColor;
|
||
|
|
||
|
public class Main {
|
||
|
public static void main(String[] args) {
|
||
|
ColoredString coloredString = new ColoredString("Hello World", "red", "blue", TextStyle.BOLD, TextStyle.ITALIC);
|
||
|
System.out.println(coloredString.toColoredString());
|
||
|
|
||
|
new Thread(() -> {
|
||
|
while (true) {
|
||
|
System.out.println(new ColoredString("Hi",
|
||
|
new TextColor.RGB((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)),
|
||
|
new TextColor.RGB((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)),
|
||
|
TextStyle.values()[(int) (Math.random() * TextStyle.values().length)]).toColoredString());
|
||
|
try {
|
||
|
Thread.sleep(1000);
|
||
|
} catch (InterruptedException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
}
|
||
|
}).start();
|
||
|
}
|
||
|
}
|