I try to build a website with a color picker.
For that, I would like to use some sort of semicircle with which you can choose the hue and a triangle with which you can choose the saturation and lightness.
I got my semicircle/color wheel and also the triangle shape so I only need the background/color of the triangle.
For that, I need a linear-gradient in another linear-gradient (like a gradient-array).
#colorTriangle {
width: 250px;
height: 200px;
background-image: linear-gradient(hsl(0, 100%, 50%), linear-gradient(hsl(0, 0%, 100%), hsl(0, 100%, 0%)));
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
<div id="colorTriangle"></div>
2
Answers
The
linear-gradient
term should not appear twice in your property value. You’re effectively nesting gradients here. Take the second one out, along with the extra closing parenthesis.Since your triangle supposed to be equilateral, its
height
would beh = (a√3)/2
.Or here we can use
h = 0.866a
.And instead of
linear-gradient
I’d useradial-gradient
: