I have some trouble with tikz. I wanted to draw a flag in Tikz - but that with minimal success. Here a sketch: Sketch

The sketch is not how it should look like: the letters are just there so I am able to tell you what I actually wanted. The black rectangles shouldn't be there either, it should just show you the regions. It should just look like a green rectangle on a red rectangle with a star in the middle.

The letters are coordinates (in px). Here the coordinates:

The flag edges:

  • N=(0, 300)
  • M=(450, 0)

The star edges:

  • A=(200, 180)

  • B=(185, 135)

  • C=(225, 205)

  • D=(265, 135)

  • E=(250, 180)

Here is what I tried:


\definecolor{grun}{HTML}{239d48}%green - colour of the top rectangle
\definecolor{rot}{HTML}{bf0028}%red - colour of the bottom rectangle
\definecolor{gelb}{HTML}{f6ec0f}%yellow - colour of the star


\fill[fill=grun] (0, 0) rectangle (12, 4.5);
\fill[fill=red] (0,4.5) rectangle (12, 9);


Problems: I don't know why definecolor don't work for "rot" and "gelb". I don't know how to define the units for tikz (so instead of using cm I could write the coordinates in px and get an result). I don't know how to draw the star.

Bonus question: Is it possible to play with the scale of the done tikzpicture (so make it fill the whole page)? I thought of something like minipage? But that is not an important question, I am just curious for next Tikz projects.

Kind regards and thank you in advance!

  • The HTML color specifications should be upper cased (239d48 -> 239D48). You can use the x and y tikz options to specify base units. How is the star supposed to be drawn? Mar 4, 2015 at 16:35
  • Thank you very much! @erik has already answered my question :-) ... but that with the big letters and x and y units helped a lot! Mar 4, 2015 at 16:45
  • Do you want to draw the flag of Burkina Faso? Mar 5, 2015 at 7:05
  • @PaulGaborit I've just noticed the similarity as well. But in that case the green and red parts of the flag should be reversed :-) Mar 7, 2015 at 8:26
  • @fpast Yes: the green and red parts of the flag should be reversed... and the star should be "contained within an imaginary circle equaling one-third the height of the flag." (cf. flagspot.net/flags/bf%27.html) Mar 7, 2015 at 11:58

3 Answers 3


Since adequate answers have already been given, I've felt free to do this picture with MetaPost.

For me it was an occasion to use some recent features of the luamplib package, (which gives an interface to MetaPost in LuaLaTeX). More precisely, I've made use of the px unit (which I didn't know of) thanks to the \mpdim command, and of the integration of colors defined by the xcolor package, via the \mpcolor command.

The rectangle's dimensions follow the OP's first wishes, except for the star, for which it seems that several points are missing. So I've included a star of my own.

Edit I've made some minor changes, for the flag to be more like Burkina-Faso's official one, the way Paul Gaborit reports in its comment on the OP's question. So the red and green parts are reversed, and the star diameter is exactly one-third of the flag's height.

\usepackage{luamplib, xcolor}

\definecolor{grun}{HTML}{239D48}%green - colour of the top rectangle
\definecolor{rot}{HTML}{BF0028}%red - colour of the bottom rectangle
\definecolor{gelb}{HTML}{F6eC0F}%yellow - colour of the star


u := \mpdim{1px}; % Unit length

    z = u*(450, 300); path rect; rect = unitsquare xscaled x yscaled .5y;
    % Star summits (I was not able to use the OP's given coordinates)
    pair S[]; S0 = y/6*right rotated 18;    
    for i = 2 step 2 until 8: S[i] := S[i-2] rotated 72; endfor
    for i = 1 step 2 until 9:
        S[i] = whatever[S[(i-3) mod 10], S[(i+1) mod 10]] = whatever[S[i-1], S[(i+3) mod 10]];
    % Drawings
    fill rect withcolor \mpcolor{grun}; 
    fill rect shifted (0, .5y) withcolor \mpcolor{rot};
    fill S0 for i = 1 upto 9: -- S[i] endfor -- cycle shifted .5z withcolor \mpcolor{gelb};


enter image description here


Noting that 1px=0.026458cm you can set the units in tikzpicture as


And use standalone class. Now your code will be




  \fill[fill=grun] (0, 0) rectangle (450,150);
  \fill[fill=rot] (0,150) rectangle (450,300);
  \node [star,fill=gelb,minimum size=113,star point height=33] at (225,150){};


enter image description here

Unlike erik's approach which needs atleast 2 compilation runs, now you compile once to get the flag and it is up to scale filling the entire page.

  • Alternatively, you could use the x and y options and \paperwidth to fill up the page. Mar 5, 2015 at 8:24

As mentioned in the comments, you need to use capital letters in your \definecolor argument for HTML.

You can use the geometry package to set the page size to your desired flag size, then make the tikzpicture fill the whole page by using \begin{tikzpicture}[remember picture,overlay] and referencing anchors of the current page node. I've done this in the example below, but placed a star in the center. The points of the star may not have exactly the coordinates you listed, but you should be able to easily adjust the size to achieve what you want.


\definecolor{grun}{HTML}{239D48}%green - colour of the top rectangle
\definecolor{rot}{HTML}{BF0028}%red - colour of the bottom rectangle
\definecolor{gelb}{HTML}{F6EC0F}%yellow - colour of the star

\begin{tikzpicture}[remember picture,overlay]
\fill[grun] (current page.south west) rectangle (current page.east);
\fill[rot] (current page.west) rectangle (current page.north east);
\node [star,fill=gelb,minimum size=5cm,star point height=1.5cm] at (current page.center){};

enter image description here

  • You're welcome! However, in the future I suggest waiting a bit longer before accepting an answer, as the first answer may not be the best.
    – erik
    Mar 4, 2015 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.