Thursday, April 4, 2024

How to create a rainbow background color with "radial-gradient" by JavaScript?


I am making a clock.

I wanted to make a background image of the clock  like rainbow color  by only JavaScript.

I used this JavaScript code:



Type    "radial - gradient".
 
-  control a direction with   "circle at 80 %  70 %".

-  choose color like   "green"   above.

-  size the color to be big or small  like   "green 5 %".

-  add   " transparent "   to make the color stronger or weaker  with   " % "   like   "transparent 100%".



The result will be like this :