Açıklama Yok https://github.com/anas-elgarhy/JColorfulConsole

Anas bde4bf1a17 chore: just bump the package ver 1 yıl önce
.github e6badfa32a chore(deps): update gradle/gradle-build-action digest to 8f08e41 1 yıl önce
.idea f2b21cfb6b Up version ⬆️⬆️⬆️ 2 yıl önce
.m2 af33c478bc fix 2 yıl önce
Screenshots 3cce7ba71e Add examples 2 yıl önce
src 3cce7ba71e Add examples 2 yıl önce
.gitignore 26aaf22c77 Add .m2/settings.xml 2 yıl önce
.mergify.yml f71b63a9c8 ci(Mergify): configuration update 1 yıl önce
CODE_OF_CONDUCT.md aff60febb4 Create CODE_OF_CONDUCT.md 2 yıl önce
CONTRIBUTING.md d55d29ff0c Add contributing gide 💙 2 yıl önce
LICENSE.txt fb8ba71e67 Change license MIT -> GPTv3 2 yıl önce
README.md bde4bf1a17 chore: just bump the package ver 1 yıl önce
pom.xml bde4bf1a17 chore: just bump the package ver 1 yıl önce
renovate.json 130881c32e Add renovate.json 1 yıl önce

README.md

JColorfulConsole is a console color library.

Vulnerabilities Quality Gate Status Technical Debt Lines of Code Code Smells Maintainability Rating Security Rating Bugs

Features:

  • Support text color.
  • Support background color.
  • Support 256 colors (RGB).
  • Support ANSI colors.
  • Support indexed colors.
  • Support text style.
  • Lightweight and fast.
  • Easy to use.

How to add this library into your project

Maven

Step 1. Add the JitPack repository to your build file


<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>

Step 2. Add the dependency

<dependency>
	<groupId>com.github.0x61nas</groupId>
	<artifactId>JColorfulConsole</artifactId>
	<version>1.0.4</version>
</dependency>

Gradle:

Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.0x61nas:JColorfulConsole:1.0.4'
	}

Usage:

public class Example1 {
    public static void main(String[] args) {
        ColoredString hello = new ColoredString("Hello, ");
        hello.setForegroundColor(TextColor.ANSI.BLUE); // Set text color to blue
        hello.setBackgroundColor("magenta"); // Set background color to magenta
        hello.addStyle(TextStyle.BOLD); // Add bold style

        ColoredString world = new ColoredString();
        world.setStr("World!"); // Set string to "World!"
        world.setForegroundColor("#542413"); // Set text color
        world.setBackgroundColor(new TextColor.RGB(34, 139, 34)); // Set background color
        world.addStyle(TextStyle.ITALIC); // Add italic style

        System.out.print(hello); // Print colored string
        System.out.print(world); // Print colored string

    }
}

Result of example 1

public class Example2 {
    public static void main(String[] args) {
        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)]));
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}

Result of example 2

Requirements for development:

  • Maven
  • jdk 17
  • IntelliJ IDEA (not required but recommended)

TODO

  • Add Tests
  • Add Formatter
  • Add Documentation
  • Add more examples

Projects using this library 💙

Available in

GitHub GitLab BitBucket Codeberg

Quality gate

SonarCloud