Konloch Software

Color Utils

Published 02/20/2023 Updated 02/26/2023

ColorUtils is a small collection of utility functions to deal with coloring on Java.

What Does It Do?

  • Small Java Library that provides static functions for dealing with Java AWT Color.
  • Example API Usage:
    • Color setAlpha(Color color, int alpha);// Set the alpha value of a Color object
    • Color setAlpha(Color color, double alpha);// Set the alpha value of a Color object
    • int pack(int r, int g, int b);// Pack RGB color values into an integer
    • double getDifference(Color colorA, Color colorB);// Compare two colors and return the difference between the color values
    • String getHex(Color color);// Generate a hex color code from a Color object
    • String getHex(int rgbColor);// Generate a hex color code from an RGB integer
    • Color fromHex(String hexColorCode);// Generate a new Color instance from a hex color code

Links

Requirements

  • Java 8 or greater

How To Integrate as a Dependency

Add the following to your pom.xml as a maven dependency, or just download the latest release and import it with your IDE.

<dependency>
	<groupId>com.konloch</groupId>
	<artifactId>ColorUtils</artifactId>
	<version>1.2.0</version>
</dependency>

How To Use

The library is so tiny, take a look for yourself. Click here to view the source.

Latest Updates

Color Utils v1.2.0

This is the third public release of the library, it has been heavily tested but please feel free to report any issues found.

To add it as a…

Read More

Color Utils v1.1.0

This is the second public release of the library, it has been heavily tested but please feel free to report any issues found.

To add it as a…

Read More

Color Utils v1.0.0

This is the first public release of the library, it has been heavily tested but please feel free to report any issues found.

To add it as a…

Read More