I want to make a dynamic gradient. I have a single color and i want to generate 5 color’s gradient same as below.
eg.
background-image: -webkit-linear-gradient(top,
rgba(235, 82, 164, 1.00) 0% ,
rgba(244, 49, 153, 1.00) 18% ,
rgba(245, 0, 130, 1.00) 56% ,// this color i have
rgba(196, 0, 104, 1.00) 84% ,
rgba(171, 0, 91, 1.00) 100% );
Is there any way to get 4 other colors similar to original color in order to get a good effect. (Colors order is light to dark)
This functionality is built into most CSS frameworks, such as SASS, LESS etc.
If you want to know how it is done, take a look at the source code for the language of your choice. It is however done during compilation of a stylesheet, so once the compilation is complete, the rule is generated as static code.
For instance, this is from the LESS source code: