Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Add Color Constructor Nodes

Open phailhaus opened this issue 6 months ago • 4 comments

Resolves #2774

Adds the following:

color crate function:

from_cmyka() function to convert CMYKA to RGBA

Nodes:

All nodes clamp input to 0 -> 1 before passing to matching function in color crate

construct_color_rgba() accepts f32 inputs in RGBA format and outputs a color construct_color_hsla() accepts f32 inputs in HSLA format and outputs a color ConstructColorDemo.zip

construct_color_grayscale() accepts a single f32 luminance input and outputs a color construct_color_cmyka() accepts f32 inputs in CMYKA format and outputs a color

I am struggling to understand more complex node construction. These could likely get merged, but I couldn't figure out how to create options that swap out inputs.

Demo: ConstructColorDemo.zip

The squares in the background test the four nodes in order from the center out. The dots in the foreground demonstrate a more practical use, deriving color from the instance index in a way that can't be done with a simple gradient.

ConstructColorDemo

phailhaus avatar Jun 28 '25 04:06 phailhaus

I'll mark this as a draft for the moment while awaiting the requested code review changes for the naming scheme and parameter types. Please mark it as ready for review once resolved, thanks!

Keavon avatar Jul 06 '25 04:07 Keavon

!build

Keavon avatar Jul 12 '25 06:07 Keavon

📦 Build Complete for 541ec145e7e1fd858a397f68f07cd54f27cacbda
https://0938a41a.graphite.pages.dev

github-actions[bot] avatar Jul 12 '25 06:07 github-actions[bot]

I see there is a conflict, can you please resolve it? And once this is fully ready for review, please mark it as such so it's not a draft (I ignore drafts when working through my review queue).

Keavon avatar Jul 12 '25 06:07 Keavon