How to add color when drawing text on the canvas in JavaScript

1 Answer

0 votes
<canvas id="canvas"></canvas>
<script type="text/JavaScript">   

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

ctx.font = "32px Comic Sans MS";
ctx.fillStyle = "red";
ctx.fillText("PHP Programming", 20, 100);

/*
run:  
  
   
*/
  
</script>

 



answered May 25, 2016 by avibootz
...