Skip to content

DJ-Raven/swing-color-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swing Color Picker

A Java Swing color picker built on FlatLaf, designed to work with built-in and customizable picker models, a color palette, and configurable UI elements.

color-picker 

Installation

Maven Central

Add the dependency

<dependency>
    <groupId>io.github.dj-raven</groupId>
    <artifactId>swing-color-picker</artifactId>
    <version>2.0.0</version>
</dependency>

Snapshots

To get the latest updates before the release, you can use the snapshot version from Sonatype Central

<repositories>
    <repository>
        <name>Central Portal Snapshots</name>
        <id>central-portal-snapshots</id>
        <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </repository>
</repositories>

Add the snapshot version

<dependency>
    <groupId>io.github.dj-raven</groupId>
    <artifactId>swing-color-picker</artifactId>
    <version>2.0.0-SNAPSHOT</version>
</dependency>

Usage

// create color picker object
ColorPicker colorPicker = new ColorPicker();

// create event color changed
colorPicker.addColorChangedListener((color, event) -> {
    // color changed
});

Show with Dialog

Color color = ColorPicker.showDialog(this, "Pick Color", Color.WHITE);

if (color != null) {
    // color selected
}

Change Model

// create color picker object with an initial model
ColorPicker colorPicker = new ColorPicker(new DiskColorPickerModel());

// change to a different color picker model
colorPicker.setModel(new CorelTriangleColorPickerModel());

Available Model

Model Name Description
DinoColorPickerModel Default HSV color model
DiskColorPickerModel Circular color wheel
CorelSquareColorPickerModel Square color selector with circular hue wheel
CorelTriangleColorPickerModel Triangle selector with circular hue wheel
CorelRhombusColorPickerModel Rhombus selector with circular hue wheel

Library Resources

  • FlatLaf - FlatLaf library for the modern UI design theme

About

Java Swing color picker built with FlatLaf

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors

Languages