Tuesday, October 23, 2018

Color Chooser

Aloha from San Francisco,

The last weeks I was really busy working on a customer project in JavaFX. At the moment I can't really show something but I needed an additional control which I now will open source. It is a color chooser as you can also find in some vector drawing programs.
Here is a screenshot of that control to give you an idea...

So as you can see this control is made to select a fill and a stroke which could than be applied to a shape or whatever you like.
You can switch between different color modes e.g. RGB, RGB Hex and HSL which will directly affect the three sliders. 
When choosing HSL the sliders will be used for Hue, Saturation and Luminance. I might also add HSB support but at the moment it only supports the three modes mentioned above.
You could either use the sliders or type in the values in the textfields behind the sliders. Or if you like you could also type in the color in the text field below the sliders.
In addition you can also select a color by clicking in the multi-gradient field.
For each selected color you can define the opacity by either using the opacity slider or select a predefined opacity from the drop down box besides the opacity slider.
You can define a color for the fill and one for the stroke depending on what you have selected on the top left.
The selection color (red in the screenshot) can also be defined.
Like mentioned I needed that control for a current customer project and so created it the way I need it. Meaning to say it might not directly work for you but as always you can find the code over at github, so feel free to fork it :)

Source at github

That's it for today...so keep coding... :)

No comments:

Post a Comment