Search for '{{search_term}}'

Flag of Hungary in SVG

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

This is part of the SVG Tutorial and exercises drawing the Hungarian flag in SVG.

Accoridng to the Wikipedia and the Wikimedia svg, the Hungarian flag has a 2:1 ratio and the 3 stripes have the following RGB color values: The Red is #CD2A3E, the white is, well, it is white #FFFFFF, and the green is #436F4D.

function flag_of_hungary() {
    var draw = SVG('flag_of_hungary');
    var width = 120;
    var height = width/2;
    draw.size(width, height);

    var red   = draw.rect(width, height/3).fill({ color: '#CD2A3E' });
    var white = draw.rect(width, height/3).fill({ color: '#FFFFFF' }).dy(height/3);
    var green = draw.rect(width, height/3).fill({ color: '#436F4D' }).dy(2*height/3);


In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus