this is my first time here. I load a SVG with Javascript into an HTML document. I need to replace the color of this SVG (it's a black image with transparency), which is placed into a canvas; however, when I put the css (style), nothing happens.
This is my code:
<!DOCTYPE html>
<html>
<head>
<title>TEST CANVAS</title>
    <script>
        function draw_img(){
            var img = document.getElementById("test");
            test.width = 300;
            test.height = 300;
            var ctx = test.getContext('2d');
            var source = new Image();
            source.src = './field/image.svg';
            source.onload = function(){
                ctx.drawImage(source, 0, 0);
            }                       
        }
    </script>
</head>
<style>
    canvas#test {
    fill:darkred;
}
</style>
    <body onload = "draw_img();">
    <h1>TEST</h1>
    <canvas id="test"></canvas>
    </body>
</html>
What's wrong with it? Sorry for my bad English and thanks in advance
 
    