Colorful output library for Java
Explore the repository »
View Code
·
Report Bug
·
Request Feature
Table of Contents
jColors is a lightweight Java library to make printing colored output to the console super easy. Unlike many libraries that provide this feature but with hard syntax or limited abilities, jColors provides you with full capabilities. The library is fully coded in Java and the syntax is easy to understand and very intuitive.
- Runs on any type of console/terminal (even cmd on Windows out of the box!)
- Easy to integrate with your projects, just add the necessary .jar files and you're all set!
- Wide range of styles, colors and background colors!
- You can read input in colors and styles as well! (not only output)
- You can make your own combinations (use many styles together)
- Styles: normal, bold, underline, inverse.
- Foreground colors: black, red, green, yellow, blue, magenta, cyan, white (+ strong variations)
- Background colors: black, red, green, yellow, blue, magenta, cyan, white (+ strong variations)
- Input colors: black, red, green, yellow, blue, magenta, cyan, white
You can try run the Main.java program to get a look at all available styles in action.
jColors is simple and easy to use by design. Setting up jColors in your project takes only a few clicks, and you'll enjoy hundreds of styles.
This library relies on the JNA (Java Native Access) library. Make sure to download JNA and add it to your classpath before running jColors in your project.
- jna-version.jar
- jna-platform-version.jar
To integrate jColors in your project, you can either add the .jar files to your IDE or add them to your classpath if you want to compile it by yourself.
- Import jColors
import jcolors.*;
- Setup Windows CMD compatibility (optional)
jcolors.setup();
- Print your first colored output!
System.out.println(fgColors.yellow("We did it!!"));
- Read your first colored input!
inputColorsStrong.cyan(); System.out.print(">> "); String input = input.nextLine(); inputColorsStrong.close();
To compile & run your java files using the jColors Library manually from the cmd use the next command.
javac -classpath "jcolors/library/location;jna/library/location/jna/platform/library/location" Class.java
java -classpath "project/location;jcolors/location;jna/location/jna/platform/location" package.Class
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the GNU General Public License. See LICENSE
for more information.
Jihed Kdiss - @jiokdiss - jihedkdiss@outlook.com
Project Link: https://github.com/jihedkdiss/jColors