g | x | w | all
Bytes Lang Time Link
126TIBASIC TI83 Plus250527T194911Zmadeforl
165SVG250525T055950ZMiro
113R250202T164221ZGlory2Uk
190Python 3 + pycairo241022T102559Zdavid
180Python 3.10 + Turtle241025T131249ZSevC_10
111PICO8250126T203538ZJosiah W
463MS SQL Server Management Studio241030T184825Zjdt
100C GCC241130T181946Zmatteo_c
221AWK241030T175823Zxrs
210C64 BASIC241103T182019Zjdt
127Python 3241101T123602ZGuitarPi
228Chipmunk Basic241031T020016Zroblogic
099Shadertoy GLSL241026T022041ZVicente
043GFABasic 3.51 Atari ST241021T215301ZArnauld
125SVG241022T073743ZHand-E-F
039TinyAPL241022T172229Znoodle p
058SVG241020T210107ZLevel Ri
023Wolfram Language Mathematica241022T164503ZZaMoC
112PNG241022T153958ZJordan
021Uiua241021T221055Znoodle p
012Desmos241020T210050Zemanresu
030Uiua241021T075350Zmousetai
140ZX Spectrum Basic241021T084905ZNeil
043TinyAPL241020T203219ZRubenVer

TI-BASIC (TI-83 Plus), 126 bytes

I don't think this counts as a passing answer but I just had to try

0→Xmin
18→Xmax
0→Ymin
12→Ymax
ΔX→U
Circle(7,6,4
For(A,0,3,U
Line(A,0,A,6
End
For(A,11,18,U
Line(A,0,A,6
End
Horizontal U
For(A,16,56
60→B
Repeat pxl-Test(B,A
Pxl-On(B,A
B-1→B
End
Line(AU,6,AU,BΔY
End

Don't have your grid on.

It looks exactly like the Greenland flag, except the red is black.

I have no way of currently showing the output, so you just gotta take my word for it. :(

SVG, 165 bytes

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6"><path fill="#fff" d="M0 0h9v6H0"/><path fill="red" d="M0 3h9v3H0m1.5-3a2 2 0 0 0 4 0 2 2 0 0 0-4 0"/></svg>

Flems

HTML, 130 bytes

<svg viewBox="0 0 9 6"><path fill="#fff" d="M0 0h9v6H0"/><path fill="red" d="M0 3h9v3H0m1.5-3a2 2 0 0 0 4 0 2 2 0 0 0-4 0"/></svg>

Flems

(without xmlns)

R, 113 bytes

barplot(rbind(1,1),co=a<-c(2,0),bo=0);par(new=T,fig=c(0,.88,.12,.88),mar=c(1,0,0,0)+1.8);pie(c(1,1),NA,co=a,bo=0)

In order to get the png-file with the correct dimensions (as below):

png(filename="greenland.png", width=567, height=429)
barplot(rbind(1,1),co=a<-c(2,0),bo=0);par(new=T,fig=c(0,.88,.12,.88),mar=c(1,0,0,0)+1.8);pie(c(1,1),NA,co=a,bo=0)
dev.off()

Explanation:

The first barplot() plots two horizontal bars, a white and a pinkish one. par() with new=TRUE redirects the graphic output to the same graph window, in order to overlay the graphs. The arguments fig and mar were optimized by trial and error in order to fulfill the flag pattern ratios. Finally, pie() plots a pie chart with 2 sections, without labels (NA), the same colors as in the barplot and without border.

greenland

Python 3 + pycairo, 199190 bytes

Golfed 9 bytes thanks to @musava-ribica and different import

from cairo import*
x=Context(SVGSurface("g",18,12))
s=x.set_source_rgb
f=x.fill
r=7,6,4,0,3.14
s(1,1,1)
x.paint()
s(1,0,0)
x.rectangle(0,6,18,6)
x.arc_negative(*r)
f()
s(1,1,1)
x.arc(*r)
f()

enter image description here

Python 3.10 + Turtle, 184 180 bytes

The script draws the flag with minimum dimensions 18x12.

Edit:

-4 bytes thanks to @WeirdGlyphs

from turtle import*
x=setx
b=begin_fill
def c():circle(4,180);end_fill()
setup(18,12)
ht()
color(1,0,0)
b()
x(-6)
x(-9)
sety(-6)
x(9)
sety(0)
x(2)
seth(90)
c()
color(1,1,1)
b()
c()

Try it online!


Result:

greenland flag

PICO-8, 111 bytes

cls()rectfill(0,0,89,59,1)circfill(35,30,20,2)poke(24414,68)rectfill(0,30,89,59,4)pal({7,8,0,0,8,7},1)while(1)?

A 128 by 128 pixel screen, with the flag of Greenland drawn on the top left corner covering about a third of the screen.

The bottom half of the flag has its color changed using a rectangle drawn on bitplane 2.

MS SQL Server - Management Studio, 483 463 bytes

CREATE TABLE F(P GEOMETRY)
DECLARE @c geometry=geometry::Point(0,0,0).STBuffer(4)
DECLARE @t geometry='POLYGON((-7 6,11 6,11 0,-7 0,-7 6))'
DECLARE @b geometry='POLYGON((-7 -6,11 -6,11 0,-7 0,-7 -6))'
DECLARE @i INT=1
WHILE @i<802 BEGIN INSERT INTO F(P)VALUES('POLYGON((0 0,1e-9 1e-9,0 1e-9,0 0))');SET @i=@i+1;END
INSERT INTO F(P)VALUES(@t.STDifference(@c).STUnion(@b.STIntersection(@c))),(@t.STIntersection(@c).STUnion(@b.STDifference(@c)))
SELECT*FROM F

More of a hot pink than red:

enter image description here

640 bytes to get a nicer red by overlapping the geometries:

CREATE TABLE #R(P GEOMETRY)
DECLARE @c geometry=geometry::Point(0,0,0).STBuffer(4)
DECLARE @t geometry='POLYGON((-7 6,11 6,11 0,-7 0,-7 6))'
DECLARE @b geometry='POLYGON((-7 -6,11 -6,11 0,-7 0,-7 -6))'
DECLARE @e geometry='POLYGON((0 0,1e-9 1e-9,0 1e-9,0 0))'
DECLARE @i INT=1
WHILE @i<802 BEGIN INSERT INTO #R(P)VALUES(@e);SET @i=@i+1;END
INSERT INTO #R(P)VALUES(@t.STDifference(@c).STUnion(@b.STIntersection(@c))),(@t.STIntersection(@c).STUnion(@b.STDifference(@c)))
SET @i=0
WHILE @i<5 BEGIN INSERT INTO #R(P)VALUES(@e);SET @i=@i+1;END
INSERT INTO #R(P)VALUES(@t.STIntersection(@c).STUnion(@b.STDifference(@c)))
SELECT*FROM #R

enter image description here

C (GCC), 101 100 bytes

i;main(k){for(puts("P6 18 12 1");i<648;putchar(i<324^i/54*(i/54-11)+k*(k-13)<-57|i++%3<1))k=i%54/3;}

Attempt This Online!

Outputs a PPM image.

Result: resulting image

AWK, 221 bytes

func p(a,b){for(;a--;)printf(b?"\033[97m":"\033[31m")"█"}{n=$1;r=n/2;for(y=-r+2;y++<r-2;){g=n*y<r;p(int(2*r/3),g)
for(x=-r;x++<r;)x*x+y*y*4<r*r?p(1,!g):p(1,g);p(n,g);print"";if(!y){p(int(2*r/3))p(n-1,1)p(n+1);print""}}}

Fixed so it should now scale without getting into an infinite loop:

awk 'func p(a,b){for(;a--;)printf(b?"\033[97m":"\033[31m")"█"}{n=$1;r=n/2;for(y=-r+2;y++<r-2;){g=n*y<r;p(int(2*r/3),g)
for(x=-r;x++<r;)x*x+y*y*4<r*r?p(1,!g):p(1,g);p(n,g);print"";if(!y){p(int(2*r/3))p(n-1,1)p(n+1);print""}}}' <<< 30

Flag of Greenland

C64 BASIC, 210 bytes

1pO53265,187:pO53272,24
2fOy=0to199:fOx=0to319:pO1024+x*y/62,18
3a=8192+int(y/8)*320+int(x/8)*8+(yaN7)
4c=abs(((116-x)^2+(100-y)^2>4356)=(y>100)):b=7-(xaN7):q=pE(a)
5pOa,(qor2^b)*(1-c)+(qaN(nO2^b))*c:nE:nE
6gO6

Draws the flag in high-res graphics mode in about 4 hours.

enter image description here

Try in emulator

Python 3, 127 bytes

This uses XOR for the alternating colors, and a distance formula for the circle, and some ANSI codes for the color changes. Changing to black after every character instead of when done with a line saved 2 bytes. I could probably cheat a couple more bytes by finding resolutions that would let me omit decimals, maybe saving another 4 bytes but there would probably be some rounding errors. The solution as it stands can be adjusted for other resolutions.

for y in range(12):
 for x in range(18):print("\033[4"+("7"if(y<6)^((x-6.5)**2+(y-5.5)**2<16)else"1"),end="m \033[0m")
 print()

Flag output from VSCode terminal

Chipmunk Basic, 252 225 228 bytes

graphics 0:k(0):graphics fillrect 0,60,180,120:t=pi/2
for i=t to t*3 step.002:k(0):p(i):k(99):p(i+pi):next
sub p(a):x=70+sin(a)*40:graphics moveto x,60:graphics lineto x,60+cos(a)*40:return
sub k(c):graphics color 99,c,c:return

Install v368b202 (MacOS) to test - the online compiler doesn't do graphics. Corrected artefacts by filling the semi-circles with vertical lines instead of radiating from the centre. Circle is now centred at (70,60) - was incorrectly placed at (90,60) before.

Description
1: k(0) :set colour to red, draw the lower rectangle, let t = π/2
2: loop from right of circle (angle t) to left (t*3)
     k(0):p(i) :red line at angle i
     k(99):p(i+pi) :white line at angle i+π
3: sub p(a) :draw a line segment from (90,60) (x,60) to (x,y) given by sin() and cos()
4: sub k(c) :change pen colour using chipmunk basic's RGB range of (0-100)

Ungolfed prototype version

A basic Poland flag

Shadertoy (GLSL), 99 bytes

void mainImage(out vec4 a,vec2 b){a=vec4(1,vec3(b.y<225.^^distance(vec2(262.5,225.),b)<150.?0:1));}

Shadertoy link.


enter image description here

Arguably cheating since the shader has to be run at just the right resolution (450x675) for the image to be correct, which Shadertoy doesn't even support, but I was too excited about the XOR trick to not share :)

GFA-Basic 3.51 (Atari ST), 43 bytes

A manually edited listing in .LST format. All lines end with CR, including the last one.

SET 15,1792
PC 35,30,20
GR 3
PB 0,30,90,60

Expanded and commented

SETCOLOR 15,1792 ! set color #15 to 0x700 = red
PCIRCLE 35,30,20 ! draw a filled circle of radius 20 at (35,30)
GRAPHMODE 3      ! set the drawing mode to XOR
PBOX 0,30,90,60  ! draw a filled rectangle from (0,30) to (90,60)

Output

output

SVG, 127 125 bytes

<svg viewBox=".5,0,9,6"><path fill="red" d="M10,0V6H0V0"/><path fill="#FFF" d="M0,0V3H2A2,2,0,116,3A2,2,0,112,3h9V0"/></svg>

Expanded:

<svg viewBox=".5,0,9,6">
  <path fill="red" d="
    M 10,0
    V 6
    H 0
    V 0
  "/>
  <path fill="#FFF" d="
    M 0,0
    V 3
    H 2
    A 2,2 0 1 1 6,3
    A 2,2 0 1 1 2,3
    h 9
    V 0
  "/>
</svg>

TinyAPL, 43 39 bytes*

⎕DisplayImage 1∘⍪⍤⍪⍨◠⊖⍤~⊸⍪4≥⍉|7-18⊕⊞⍥⍳6

Try it: TinyAPL REPL

-4 thanks to RubenVerg for telling me that some parentheses were unnecessary and suggesting a clever way to get around parentheses in (⍳6).

This is based on my Uiua solution.

Explanation:

18⊕⊞⍥⍳6 - the 18x6 table of complex numbers (0..17)+(0..5)i.

⍉|7- - subtract the real parts from 7, get the magnitude (\$ \sqrt{a^2+b^2} \$) of each, and transpose. This gives a 6x18 grid where each cell contains its distance to (0, 7).

4≥ - Is each distance greater than or equal to 4? This gives a zero for pixels in the circle and a one for pixels outside.

⊖⍤~⊸⍪ - Prepend a reversed, inverted copy of the array. This adds on the top half of the flag, yielding a 12x18 boolean array. The booleans still have to be mapped to colors.

1∘⍪⍤⍪⍨◠ - To each value, prepend a one and itself, giving a length-3 array. This maps zeroes to 1,0,0 and ones to 1,1,1, which correspond to red and white respectively in RGB colors. The result is a 12x18x3 array representing the image.

⎕DisplayImage - Self-explanatory.


*Encoded with 1 byte per character using (⎕Import"std:sbcs")→Encode.

SVG, 60 58bytes

Tested in Chrome and Edge. 1 byte saved thanks to Neil and 1 byte of whitespace deleted.

<svg><path d="M0 30h55a20 20 0 1 0 0 1h35v29H0"fill="red">

Drawn at 5 times the scale in the question (maybe I can go lower for less bytes.) The trick here is that the circle is not quite complete. There is a tiny gap in the white section on the right hand side. We start at centre left, move to the right of the circle, complete an arc with nominal 0 degree (or with large arc flag set, 360 degree) rotation (with a tiny vertical offset to let SVG know the correct circle orientation), move to the centre right of the flag, the bottom rightand finally to the bottom left. The path is not explicitly closed but this works in most browsers.

SVG, 56 54 48 bytes

Drawn at the scale in the question, which apparently is the min allowable. This version incorporates all golfs from emanresu, shaggy and ccprog and still works in Chrome and Edge despite the nonstandard syntax.

<svg><path d=M0,6h11a4,4,0,100,.1h7v6H0 fill=red

Wolfram Language (Mathematica), 23 bytes

"GL"~CountryData~"Flag"

enter image description here

PNG, 112 bytes

Hand-drawn pixel art compressed by ImageOptim.

Tiny Greenland flag

00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452  .PNG........IHDR
00000010: 0000 0012 0000 000c 0802 0000 00e0 707a  ..............pz
00000020: eb00 0000 3749 4441 5478 0163 f84f 16a0  ....7IDATx.c.O..
00000030: 92b6 0b3c c670 845f 1ba6 1ec2 3a19 d0f4  ...<.p._....:...
00000040: 6022 aa6a c325 8ddf 380a b4c1 117e 3d98  `".j.%..8....~=.
00000050: da10 88a0 1e84 365c 88fa da00 d530 b520  ......6\.....0. 
00000060: 0d47 c1d5 0000 0000 4945 4e44 ae42 6082  .G......IEND.B`.

Uiua, 29 24 21 bytes

∵[1.]⊂¬⇌.≤4⌵⊞ℂ⇡6-7⇡18

Try it: Uiua pad

Golfed 24 -> 21 bytes thanks to Mousetail.

Output, upscaled:

screenshot of program output

I used the circle equation \$ \sqrt{(x-h)^2+(y-k)^2} \le r \$, with 6 and 7 substituted for \$ h \$ and \$ k \$, and \$ r^2 \$ being inlined as 16. Rather than squaring and square rooting, Mousetail suggested using the magnitude of the complex number x+yi, saving 3 bytes. Instead of drawing the whole circle and inverting half of it, I drew half of the circle and joined on top a reversed and inverted copy.

Multiplying each number except for the leading one by some fixed factor will give the flag at a higher resolution. Here's the output of multiplying each by ten: Uiua pad

screenshot of program with higher resolution

Desmos, 12 bytes

(r-4)sinθ<0

Try it on Desmos!

As is somewhat standard with Desmos , this uses the graph settings to frame/colour the image appropriately and remove background settings, which isn't included in the byte count. r-4 is negative within the circle of radius 4 around the origin, and sinθ is negative below the x-axis, so the image is red where exactly one of these is negative.

An alternate that only draws the part of the image in frame, for 33 bytes (leading newline is necessary to paste properly):


(xx+yy-16)y<0\{-7<x<11\}\{y>-6\}

Try it on Desmos!

Uiua, 39 30 chars

-:1⋯×6=⊞⊃(>4⌵ℂ-5.5|>5)⇡12-7⇡18

Pad Link

output

Uiua, 29 chars - More faded red

-⋯×6=⊞⊃(>4⌵ℂ-5.5|>5)⇡12-7⇡18η

faded red

Red is faded since it is the color [1, pi/4-1, pi/4-1] = [1, 0.214, 0.214] which is probably red enough.

ZX Spectrum Basic, 140 bytes

  10 DIM a$(PI*PI): FOR i=SGN PI
 TO PI: PRINT BRIGHT SGN PI; INK
 VAL "2";a$: NEXT i: FOR i=SGN P
I TO PI: PRINT BRIGHT SGN PI; IN
K VAL "7"; PAPER VAL "2";a$: NEX
T I: LET a=VAL "15": FOR i=-a TO
 a: FOR j=-a TO a: PLOT INK VAL
"8"; INVERSE i*i+j*j>VAL "255";i
+VAL "28",j+VAL "152": NEXT j: N
EXT i

The above shows how the program lists in 48K mode or with the LIST command. Explanation: 24 rows and 72 columns of pixels are drawn in bright white with a red foreground, then another 24 rows are drawn in red with a bright white foreground. A solid circle is then drawn at the appropriate position; INK 8 avoids changing the foreground colour, so the circle takes on the colour of the two rectangles. VAL and PI are used to avoid integer constants which would otherwise cost six extra bytes each.

Screenshot

TinyAPL, 43 bytes

⎕DisplayImage{1⍪2⌿0>⍵×8-|⍵⊕15}◠13-⊕⍆¨⍳24‿36

Try online

Many thanks to @emanresu A for -25 with a change in approach.

Result:

result

Explanation:

⎕DisplayImage{1⍪2⌿0>⍵×8-|⍵⊕15}◠13-⊕⍆¨⍳24‿36­⁡​‎⁠⁠⁠⁠⁠⁠⁠⁠⁠‎⁡⁠⁣⁡⁣‏⁠‎⁡⁠⁣⁡⁤‏⁠‎⁡⁠⁣⁢⁡‏⁠‎⁡⁠⁣⁢⁢‏⁠‎⁡⁠⁣⁢⁣‏⁠‎⁡⁠⁣⁢⁤‏⁠‎⁡⁠⁣⁣⁡‏⁠‎⁡⁠⁣⁣⁢‏⁠‎⁡⁠⁣⁣⁣‏‏​⁡⁠⁡‌⁢​‎⁠⁠⁠‎⁡⁠⁢⁤⁤‏⁠‎⁡⁠⁣⁡⁡‏⁠‎⁡⁠⁣⁡⁢‏‏​⁡⁠⁡‌⁣​‎⁠‎⁡⁠⁤⁢‏⁠⁠⁠‎⁡⁠⁢⁤⁢‏⁠‎⁡⁠⁢⁤⁣‏‏​⁡⁠⁡‌⁤​‎⁠⁠⁠⁠‎⁡⁠⁢⁣⁢‏⁠‎⁡⁠⁢⁣⁣‏⁠‎⁡⁠⁢⁣⁤‏⁠‎⁡⁠⁢⁤⁡‏‏​⁡⁠⁡‌⁢⁡​‎⁠‎⁡⁠⁢⁣⁡‏‏​⁡⁠⁡‌⁢⁢​‎⁠⁠⁠⁠‎⁡⁠⁢⁢⁣‏⁠‎⁡⁠⁢⁢⁤‏‏​⁡⁠⁡‌⁢⁣​‎⁠⁠‎⁡⁠⁢⁢⁡‏⁠‎⁡⁠⁢⁢⁢‏‏​⁡⁠⁡‌⁢⁤​‎⁠⁠‎⁡⁠⁢⁡⁣‏⁠‎⁡⁠⁢⁡⁤‏‏​⁡⁠⁡‌⁣⁡​‎⁠⁠⁠⁠‎⁡⁠⁤⁣‏⁠‎⁡⁠⁤⁤‏⁠‎⁡⁠⁢⁡⁡‏⁠‎⁡⁠⁢⁡⁢‏‏​⁡⁠⁡‌⁣⁢​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏⁠‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏⁠‎⁡⁠⁢⁢‏⁠‎⁡⁠⁢⁣‏⁠‎⁡⁠⁢⁤‏⁠‎⁡⁠⁣⁡‏⁠‎⁡⁠⁣⁢‏⁠‎⁡⁠⁣⁣‏⁠‎⁡⁠⁣⁤‏⁠‎⁡⁠⁤⁡‏‏​⁡⁠⁡‌­
                                  ⊕⍆¨⍳24‿36  ⍝ ‎⁡complex number matrix from 1+i to 24+36i
                               13-           ⍝ ‎⁢13 minus that, i.e. matrix from 12-i to -11-36i
             {               }◠              ⍝ ‎⁣for each element of the matrix
                         ⍵⊕15                ⍝ ‎⁤add 15i, i.e. matrix from 12+14i to -11-21i
                        |                    ⍝ ‎⁢⁡magnitude
                      8-                     ⍝ ‎⁢⁢8 minus that
                    ⍵×                       ⍝ ‎⁢⁣multiplied by the original element
                  0>                         ⍝ ‎⁢⁤is negative?
              1⍪2⌿                           ⍝ ‎⁣⁡[1, x, x] -> [1, 0, 0] (red) or [1, 1, 1] (white)
⎕DisplayImage                                ⍝ ‎⁣⁢show image in editor
💎

Created with the help of Luminespire.