
normally you would build up a gradient with white and black in the end stops The approach is different from regular gradient functions like in photoshop. looking range of colors from dark to light. produce a smooth gradient from black to white that gives a natural This program takes three colors, a pure color, a highlight and a shade, to I also have a few other questions, but first I'll post the code and show you what it does. Is there a way to replace that function with a shader? This is my first Codea program after many years of not coding and I'm still on a steep learning curve.įeel free to point out where my code is clunky or old school.įor instance the colorize function changes the test image pixel by pixel. Colors have dramatically different luminosity compared to there rgb values, so I had to find a way to redistribute the color stops according to their perceived lightness.

The next issue was to compensate for luminosity. Non of the attractor colors are actually one the curve, but they sequential pull the curve away from the gray center line. The program takes three colors, a pure color, a shade and highlight as input and uses them as attractor points. This program changes the polygon into a Bézier curve at starts at the black point, but then curves around the gray diagonal in the middle. A grayscale gradient would be a straight diagonal line from black to white. Starting from the black point drawing straight lines to the color stops to end at the white point. The classic color gradients can be seen as a 3D polygon through the rgb color cube.

This program tackles the problem with a different approach. You can also use the duo tone system, but that is even more cumbersome. I would find myself manually adding more color stops to the gradient to make the transitions more gradual. In your artwork or photo that shows up as oversaturated stripes. The problem with normal color gradients like in photoshop or illustrator, is that they make linear transitions from one color stop to the next. The first hurdle was to create good color gradients. I am working on on a program that colorizes grayscale images with color gradients.
