How to change text color randomly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

How to change text color randomly

suppose a plain text which we want to make blink through out the termination of program .

30th Oct 2019, 1:23 PM
Saroj Patel
Saroj Patel - avatar
2 Answers
+ 4
Use css animations to change colors. You'll need to previously define what colors you want.(what's problem? you have already completed css tutorial) https://www.sololearn.com/learn/CSS/2254/?ref=app OR Make a function to create random colors set random colors for your text . Something like: document.getElementById('mytext).style.color=myRandomColor; You can try js requestAnimationFrame or setInterval for making smooth transitions. https://www.sololearn.com/learn/JavaScript/2756/?ref=app Can get some idea from https://code.sololearn.com/WeCf7DNzMBdV/?ref=app For such questions please post your attempts (code) to solve the problem.
30th Oct 2019, 1:35 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 5
Thanks
30th Oct 2019, 10:46 PM
Saroj Patel
Saroj Patel - avatar