Fill color inside a circular shape on canvas




Fill color inside a circular shape on canvas examples

<!DOCTYPE html>
<html>
   <head>
      <meta charset="UTF-8">
      <title>Example of Fill Color inside a Circle</title>
      <style type="text/css">
         canvas {
            border: 2px solid #000;
         }
      </style>
      <script type="text/javascript">
         window.onload = function() {
            var canvas = document.getElementById("myCanvas");
            var context = canvas.getContext("2d");
            context.arc(150, 100, 70, 0, 2 * Math.PI, false);
            context.fillStyle = "#FB8B89";
            context.fill();
            context.lineWidth = 5;
            context.strokeStyle = "black";
            context.stroke();
         };
      </script>
   </head>
   <body>
      <canvas id="myCanvas" width="300" height="200"></canvas>
   </body>
</html>

Output