How can I code the color of background that get darker to left ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I code the color of background that get darker to left ?

19th May 2019, 7:01 PM
Hamid Mohammadi
Hamid Mohammadi - avatar
4 Answers
+ 2
You could use CSS to apply a linear-gradient, e.g. {background-image: linear-gradient(to left, color 1, color 2)}, where color 1 and color 2 are the same color but color 1 is lighter and color 2 is darker.
19th May 2019, 7:11 PM
Cyhyraeth
Cyhyraeth - avatar
+ 2
If you select the colors using HSL (Hue, Saturation, Lightness) they could have the same hue and saturation but different lightness values so one would be darker than the other.
19th May 2019, 7:20 PM
Cyhyraeth
Cyhyraeth - avatar
+ 1
Use something like this in CSS. Using deg allows you to customize the angle of the gradient. Here's an example: background-color { linear-gradient(90deg, rgba(196,125,244,1) 0%, rgba(255,104,104,1) 50%, rgba(255,208,142,1) 100%); }
20th May 2019, 6:30 AM
thisismaw
thisismaw - avatar
0
Thank you . I have two colors code . So I have to fill the colors within that style you said .
19th May 2019, 7:15 PM
Hamid Mohammadi
Hamid Mohammadi - avatar