Git Product home page Git Product logo

awt-color-factory's Introduction

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.

awt-color-factory's People

Contributors

cadiboo avatar siordache avatar

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.