Mobile app version of vmapp.org
Login or Join
Fox8063795

: Inkscape: rectangle with rainbow fill I'd like to create a shape gradiently filled with visible light spectrum colors - from red to blue. I am using Inkscape. When I try to specify gradient

@Fox8063795

Posted in: #Gradient #Inkscape #Shapes

I'd like to create a shape gradiently filled with visible light spectrum colors - from red to blue. I am using Inkscape. When I try to specify gradient from red to blue - it chooses a weird color path. Any help would be appreciated

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8063795

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah814

This has to do with the algorithm that InkScape and other graphics programs use to create gradients, namely (pseudo-code):

var gradient = []
var firstColor, secondColor, steps
for i in range(steps):
p = i/steps
R = firstColor.R * p + secondColor.R * (1 - p)
G = firstColor.G * p + secondColor.G * (1 - p)
B = firstColor.B * p + secondColor.B * (1 - p)
gradient.push((R,G,B))


The spectrum of visible light doesn't work this way though, because real world color isn't RGB. RGB is a method to trick the eyes to see many colors with few colors, just like CMYK.

Now technically, your question has no answer, because...


Color displays (e.g. computer monitors and televisions) cannot
reproduce all colors discernible by a human eye. Colors outside the
color gamut of the device, such as most spectral colors, can only be
approximated.


But let's say you want to make the approximation in InkScape. Unfortunately, you can only do this by making a big gradient with all of the colors, the SVG standard has no flag for "visible light gradients".

Using this image from Wikipedia...



You can move the two control points around until they only show the gradient from red to blue :)



Alternatively, you could use the Gradient Editor to flip the order of the colors and delete all the colors before and after red and blue.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme