Git Product home page Git Product logo

jcolorfulconsole's Introduction

JColorfulConsole is a console color library.

Vulnerabilities Duplicated Lines (%) 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

License: GPL-3.0

jcolorfulconsole's People

Contributors

0x61nas avatar mergify[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jcolorfulconsole's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/gradle-publish.yml
  • actions/checkout v3
  • actions/setup-java v3
  • gradle/gradle-build-action 8f08e41675472b8aa0aa2c356e8b2c1561af3bf9
  • gradle/gradle-build-action 8f08e41675472b8aa0aa2c356e8b2c1561af3bf9
.github/workflows/maven-publish.yml
  • actions/checkout v3
  • actions/setup-java v3
.github/workflows/mirror.yml
  • actions/checkout v3
  • actions/checkout v3
  • actions/checkout v3
maven
pom.xml
  • org.apache.maven.plugins:maven-compiler-plugin 3.11.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.