A small tools to play with JavaFX Color.derive() function - allows to create custom colors and to save those in color palettes.

Related tags

GUI DeriveColorsFX
Overview

DeriveColors Icon DeriveColorsFX

This is not a serious application. Its a small tool where I just played with the method Color::deriveColor provided by JavaFX. Also its about playing with packaging and with modules.

What is it?

  • It lets you pick any color, either from the JavaFX color picker or with a pipette from your visible screen and any background color you like.
  • Then it uses the Color::deriveColor function to create new colors based on a selected source color.
  • To create a new color the parameters hue, brightness, saturation and opacity are adjustable.
  • Slider controls are used for parameter adjustment and the slider control background is used as an interactive preview.
  • Previews are created where the source color, the derivative color blended with the background and the background color are displayed.
  • Eventually, sets of colors can be saved to *.json or *.csv files. For JSON serialization, the Jakarta JSON-Bindings API (jakarta.json.bind-api) in version 2.0 is used. Its just an experiment how this works. For CSV I was playing with Reflection in order to mimic how the JSON-B adapter worked until I found com.opencsv:opencsv:5.5.2. Well but there I was not yet successful in getting it working the modular-way. OpenCSV is actually very comfortable to use, its just not yet modularized. Hence some work still ahead.

Things that dont work as expected:

  • Well, the color pipette has currently an issue on MacOS (but most likely on any other system with HiDPI scaling). The app creates screenshots for each screen using the javafx.scene.robot.Robot().getScreenCapture(...) function. Then, the screenshot is displayed in a stage for each screen. Unfortunately, on MacOS with Retina display, the image turnsout to be blurry as it is only half of the required resolution - don't know yet whats wrong there. Most likely I am using the API in a wrong way and yup, need to read here.
  • OpenCSV is not yet working due to lack of a module descriptor.

Screenshots

Running the app without packaging

As the Maven-JavaFX plugin is used, the app can be launched as:

> git clone https://github.com/Oliver-Loeffler/DeriveColorsFX.git
> cd DeriveColorsFX
> mvn javafx:run

Install on Windows

  • ensure that any Java-17 JDK is available, e.g. from https://adoptium.net/
  • ensure that your command line environment has access to all the JDK17 command line tools such as Jlink, JPackage, JDeps etc.
> git clone https://github.com/Oliver-Loeffler/DeriveColorsFX.git
> cd DeriveColorsFX
> mvn package
> win-package.bat

Install on MacOS

  • Download and Install at least Java-17, e.g. from https://adoptium.net/
  • Ensure that the new JDK is available on your command line.
  • ensure a recent version of Maven is installed (3.8+)
# First list all installed JDKs - JDK17 should be listed there
% /usr/libexec/java_home -V

# In case multiple JDKs are installed, switch to 17.
% export JAVA_HOME=`/usr/libexec/java_home -v 17`

# clone the project from Github
% git clone https://github.com/Oliver-Loeffler/DeriveColorsFX.git
% cd DeriveColorsFX
% mvn package
% sh mac-package.sh
  • mac-package.sh will execute jlink and jpackage so that eventually a DMG image will be available in target/mac-installer.
  • There is no download option yet as I am currently no able to properly sign the created DMG, hence you have to create the DMG on your own, unfortunately. But, this is something I am going to explore as well once a while.
You might also like...

RXControls is a JavaFX custom component library.

RXControls is a JavaFX custom component library.

RXControls RXControls Version 8.x.y need javafx8 RXControls Version 11.x.y need javafx11+ 一个javafx的自定义组件库, 密码可见组件, 轮播图组件, 动态按钮组件等, 音频频谱可视化组件,歌词组件 等...

Jan 1, 2023

Custom captions (window decorations) on Windows for JavaFX

javafx-customcaption javafx-customcaption is designed to allow customizing the native window caption on Microsoft Windows Usage: You can use the follo

Dec 15, 2022

Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE 8 and provides the functionalities to use and handle easily Tiles in your JavaFX application.

Lib-Tile Intention Lib-Tile is a multi Maven project written in JavaFX and NetBeans IDE and provides the functionalities to use and handle easily Tile

Apr 13, 2022

A JavaFX UI framework to create fully customized undecorated windows

A JavaFX UI framework to create fully customized undecorated windows

CustomStage A JavaFX undecorated stage which can fully be customized Donations If this project is helpful to you and love my work and feel like showin

Jan 6, 2023

CSS keyframe animation for JavaFX. Create animations like you would do with CSS.

CSS keyframe animation for JavaFX. Create animations like you would do with CSS.

JFXAnimation CSS keyframe animation for JavaFX. If you are using JFoenix JFXAnimation is included (currently version 1.0.0 only) Requirements JDK 8 an

Dec 28, 2022

The goal of this project is to create AssertJ assertions for JavaFX (8).

The goal of this project is to create AssertJ assertions for JavaFX (8).

Jul 30, 2021

🌈 Rainbow Color Palette

🌈 Color Palette It includes Swatch, HSV, HSL, RGB, CMYK color palettes and color codes. You can enter the code below to remove the color palette you

Oct 12, 2021

A JavaFX library that allows Java2D code (Graphics2D) to be used to draw to a Canvas node.

A JavaFX library that allows Java2D code (Graphics2D) to be used to draw to a Canvas node.

FXGraphics2D Version 2.1, 3 October 2020. Overview FXGraphics2D is a free implementation of Java's Graphics2D API that targets the JavaFX Canvas. It m

Dec 31, 2022

Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.

Tray Icon implementation for JavaFX applications. Say goodbye to using AWT's SystemTray icon, instead use a JavaFX Tray Icon.

FXTrayIcon Library intended for use in JavaFX applications that makes adding a System Tray icon easier. The FXTrayIcon class handles all the messy AWT

Dec 30, 2022
Comments
  • Snapshot

    Snapshot

    Maybe I can help you with your snapshot problem.

    public static WritableImage renderScaleAwareSnapshot(Canvas canvas, double renderScale) {
    	return renderScaleAwareSnapshot(canvas, renderScale, null, 0.0, 0.0, canvas.getWidth(), canvas.getHeight());
    }
    
    public static WritableImage renderScaleAwareCanvasSnapshot(Canvas canvas, double renderScale,
    		WritableImage writableImage) {
    	return renderScaleAwareSnapshot(canvas, renderScale, writableImage, 0.0, 0.0, canvas.getWidth(),
    			canvas.getHeight());
    }
    
    public static WritableImage renderScaleAwareSnapshot(Node node, double renderScale, WritableImage writableImage,
    		double x, double y, double width, double height) {
    	int renderWidth = (int) Math.rint(renderScale * width);
    	int renderHeight = (int) Math.rint(renderScale * height);
    	if (writableImage == null || (int) Math.rint(writableImage.getWidth()) != renderWidth
    			|| (int) Math.rint(writableImage.getHeight()) != renderHeight) {
    		writableImage = new WritableImage(renderWidth, renderHeight);
    	}
    	SnapshotParameters spa = new SnapshotParameters();
    	spa.setViewport(new Rectangle2D(x * renderScale, y * renderScale, width, height));
    	spa.setTransform(Transform.scale(renderScale, renderScale));
    	return node.snapshot(spa, writableImage);
    }
    

    This code does a canvas snapshot but the principle is the same for any kind of node. You can see how I handle the renderScale (2.0 for Retina).

    opened by mipastgt 1
Owner
Oliver Löffler
Desperate 📸 😷 engineer who likes to play with 🖥️, creating functions in R, objects in JavaSE and GUIs /w JavaFX.
Oliver Löffler
A project that shows the different ways on how to create custom controls in JavaFX

JavaFX Custom Controls This project will show different ways on how to create custom controls in JavaFX. It will cover the following approaches: Resty

Gerrit Grunwald 27 Sep 5, 2022
Checkers game. Server and Client. Client's app handled in JavaFX. Play with radom player or against AI.

Checkers-JavaFX-and-Sockets Checkers game. Server and Client. Client's app handled in JavaFX. Play with radom player or against AI. If you want to pla

Jakub Bednarski 1 Mar 30, 2022
DataFX - is a JavaFX frameworks that provides additional features to create MVC based applications in JavaFX by providing routing and a context for CDI.

What you’ve stumbled upon here is a project that intends to make retrieving, massaging, populating, viewing, and editing data in JavaFX UI controls ea

Guigarage 110 Dec 29, 2022
Reads Valheim save data and outputs it to a JSON file

Valheim Save Tools This repository contains two projects. A command line interface tool that converts Valheim save files to and from JSON and processe

Koen de Kok 61 Dec 10, 2022
Old and archived; More recent development is in https://github.com/Create-Fabric/Create-Refabricated.

NOW ARCHIVED Go here for the continuation of this project. Old README Create Fabric A Fabric port of Create. Create Discord: https://discord.gg/AjRTh6

null 12 Dec 7, 2022
A collection of tools and libraries for easier development on the JavaFX platform!

This project is archived I do not realistically have the time to take care of this project, unfortunately. It originally was built along a Twitter cli

Tristan Deloche 100 Dec 13, 2022
Full Featured Google Chrome Dev Tools to JavaFX WebView browser debugging.

JavaFX WebView Debugger Via WebSocket connection to Google Chrome Dev Tools JavaFx WebView debugging with Chrome Dev tools is highly dependent on Goog

Vladimir Schneider 56 Dec 19, 2022
Android Resource Manager application to manage and analysis your app resources with many features like image resize, Color, Dimens and code Analysis

AndroidResourceManager Cross-Platform tools to manage your resources as an Android Developer, AndroidResourceManager - ARM provide five main services

Amr Hesham 26 Nov 16, 2022
An Android library that allows you to easily create applications with slide-in menus.

An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

Jeremy Feinstein 11.1k Jan 4, 2023
Custom JavaFX bindings made easy with lambdas.

EasyBind EasyBind leverages lambdas to reduce boilerplate when creating custom bindings, provides a type-safe alternative to Bindings.select* methods

Tomas Mikula 146 May 29, 2022