https://github.com/ngageoint/color-java
Color Java Library
https://github.com/ngageoint/color-java
color colors hex hex-color hex-colors hsl hsl-color java nga rgb rgb-color rgb-colors rgba
Last synced: about 2 months ago
JSON representation
Color Java Library
- Host: GitHub
- URL: https://github.com/ngageoint/color-java
- Owner: ngageoint
- License: mit
- Created: 2018-08-28T19:21:50.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T15:33:03.000Z (about 1 year ago)
- Last Synced: 2025-03-27T16:48:50.387Z (2 months ago)
- Topics: color, colors, hex, hex-color, hex-colors, hsl, hsl-color, java, nga, rgb, rgb-color, rgb-colors, rgba
- Language: Java
- Homepage: https://ngageoint.github.io/color-java/
- Size: 340 KB
- Stars: 14
- Watchers: 15
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Color Java
#### Color Lib ####
The Color Library was developed at the [National Geospatial-Intelligence Agency (NGA)](http://www.nga.mil/) in collaboration with [BIT Systems](https://www.caci.com/bit-systems/). The government has "unlimited rights" and is releasing this software to increase the impact of government investments by providing developers with the opportunity to take things in new directions. The software use, modification, and distribution rights are stipulated within the [MIT license](http://choosealicense.com/licenses/mit/).
### Pull Requests ###
If you'd like to contribute to this project, please make a pull request. We'll review the pull request and discuss the changes. All pull request contributions to this project will be released under the MIT license.Software source code previously released under an open source license and then modified by NGA staff is considered a "joint work" (see 17 USC § 101); it is partially copyrighted, partially public domain, and as a whole is protected by the copyrights of the non-government authors and must be released according to the terms of the original open source license.
### About ###
[Color](http://ngageoint.github.io/color-java/) is a Java library providing color representation with support for hex, RBG, arithmetic RBG, HSL, and integer colors.
### Usage ###
View the latest [Javadoc](http://ngageoint.github.io/color-java/docs/api/)
```java
Color rgb = Color.color(154, 205, 50);
Color rgba = Color.color(255, 165, 0, 64);
Color rgbOpacity = Color.color(255, 165, 0, 0.25f);
Color arithmeticRGB = Color.color(1.0f, 0.64705882352f, 0.0f);
Color arithmeticRGBOpacity = Color.color(1.0f, 0.64705882352f, 0.0f,
0.25098039215f);
Color hex = Color.color("#BA55D3");
Color hexAlpha = Color.color("#D9FFFF00");
Color hexInteger = Color.color(0xFFC000);
Color hexIntegerAlpha = new Color(0x40FFA500);
Color integer = Color.color(16711680);
Color integerAlpha = Color.color(-12303292);
Color hexSingles = Color.color("FF", "C0", "CB");
Color hexSinglesAlpha = Color.color("00", "00", "00", "80");
Color hexSinglesOpacity = Color.color("FF", "A5", "00", 0.25f);
Color hsl = Color.color(new float[] { 300.0f, 1.0f, 0.2509804f });
Color hsla = Color
.color(new float[] { 60.0f, 1.0f, 0.5f, 0.85098039215f });
Color orangeAlpha = Color.color(ColorConstants.ORANGE, 120);
Color orangeOpacity = Color.color(ColorConstants.ORANGE, 0.25f);Color color = Color.blue();
color.setAlpha(56);
String hexValue = color.getColorHex();
String hexShorthand = color.getColorHexShorthand();
String hexWithAlpha = color.getColorHexWithAlpha();
String hexShorthandWithAlpha = color.getColorHexShorthandWithAlpha();
int integerValue = color.getColor();
int integerAlphaValue = color.getColorWithAlpha();
int red = color.getRed();
float greenArithmetic = color.getGreenArithmetic();
String blueHex = color.getBlueHex();
String alphaHexShorthand = color.getAlphaHexShorthand();
float opacity = color.getOpacity();
float[] hslValue = color.getHSL();
float hue = color.getHue();
float saturation = color.getSaturation();
float lightness = color.getLightness();```
### Installation ###
Pull from the [Maven Central Repository](http://search.maven.org/#artifactdetails|mil.nga|color|1.0.0|jar) (JAR, POM, Source, Javadoc)
mil.nga
color
1.0.0
### Build ###
[](https://github.com/ngageoint/color-java/actions/workflows/build-test.yml)
Build this repository using Eclipse and/or Maven:
mvn clean install