canvas transformations | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

canvas transformations

how do you add the color in the text?

31st Aug 2018, 8:09 AM
Mutegeki Brian
Mutegeki Brian - avatar
3 Answers
+ 2
Hi Mutegeki Brian, In canvas you use the attributes txtId.fillText("hello world", 20, 40); txtId.fillStyle = "red"; to color. In inline-css: <tag style="color:red;></tag> In CSS: #idOne { color:red; } In additional: https://www.w3schools.com/tags/canvas_fillstyle.asp https://www.w3schools.com/tags/canvas_filltext.asp
31st Aug 2018, 8:23 AM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
+ 1
If you want to have a coloured text in a canvas: canvas.fillStyle="#ffff00"; canvas.fillText("your text", 10, 10)
31st Aug 2018, 8:22 AM
Théophile
Théophile - avatar
0
i got the answer. Thanks !!
31st Aug 2018, 8:23 AM
Mutegeki Brian
Mutegeki Brian - avatar