Module awt-color-factory

The awt-color-factory artifact

License

License

GroupId

GroupId

org.beryx
ArtifactId

ArtifactId

awt-color-factory
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Module awt-color-factory
The awt-color-factory artifact
Project URL

Project URL

https://github.com/beryx/awt-color-factory
Source Code Management

Source Code Management

https://github.com/beryx/awt-color-factory

Download awt-color-factory

How to add to project

<!-- https://jarcasting.com/artifacts/org.beryx/awt-color-factory/ -->
<dependency>
    <groupId>org.beryx</groupId>
    <artifactId>awt-color-factory</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.beryx/awt-color-factory/
implementation 'org.beryx:awt-color-factory:1.0.2'
// https://jarcasting.com/artifacts/org.beryx/awt-color-factory/
implementation ("org.beryx:awt-color-factory:1.0.2")
'org.beryx:awt-color-factory:jar:1.0.2'
<dependency org="org.beryx" name="awt-color-factory" rev="1.0.2">
  <artifact name="awt-color-factory" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.beryx', module='awt-color-factory', version='1.0.2')
)
libraryDependencies += "org.beryx" % "awt-color-factory" % "1.0.2"
[org.beryx/awt-color-factory "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

PRs Welcome License Build Status Javadocs

AWT Color Factory

💡 You can use this library regardless of the license under which your software is distributed.

In JavaFX you can easily create a javafx.scene.paint.Color object from a string representation such as "lightblue", "#aa38e0", or "0x40A8CC" by using Color.web(String colorString), Color.web(String colorString, double opacity), or Color.valueOf(String value).

This one-class project provides equivalent methods for creating java.awt.Color objects.

Example usage

Color c1 = ColorFactory.valueOf("firebrick");
Color c2 = ColorFactory.valueOf("#aa38e0");
Color c3 = ColorFactory.valueOf("0x40A8CC");
Color c4 = ColorFactory.valueOf("rgba(112,36,228,0.9)");
Color c5 = ColorFactory.web("forestgreen", 0.7);
Color c6 = ColorFactory.web("hsl(270,90%,70%)", 0.8);

See the javadoc for more details.

Why should you use this library? Can't you just call the JavaFX methods and convert the returned javafx.scene.paint.Color into a java.awt.Color? Of course you can. But you may find this little library useful if you don't want your code to depend on JavaFX. And remember, starting with JDK 11, JavaFX is no longer part of the JDK.

AWT Color Factory is available in JCenter and Maven Central.

Maven

<dependency>
    <groupId>org.beryx</groupId>
    <artifactId>awt-color-factory</artifactId>
    <version>1.0.1</version>
</dependency>

Gradle

compile 'org.beryx:awt-color-factory:1.0.1'

AWT Color Factory contains code that is almost identical to that found in javafx.scene.paint.Color, therefore the library is distributed under the same license as OpenJFX: the GPL 2 with Classpath exception. The Classpath exception clause gives you permission to include this library in your executable code, regardless of the license under which your software is distributed.

This library requires Java 7 or newer. The jar artifact is modularized under the name org.beryx.awt.color.

org.beryx

Beryx

Versions

Version
1.0.2
1.0.1
1.0.0