| Bytes | Lang | Time | Link |
|---|---|---|---|
| 203 | Brainfuck > out.ppm | 240918T152115Z | jan |
| 136 | Setanta | 240719T194004Z | bb94 |
| 088 | AWK | 241105T194137Z | xrs |
| nan | Commodore 64 Assembler | 250622T204226Z | Jani Joe |
| 070 | C64 Assembler | 250622T164710Z | OSI8 |
| 034 | Vyxal 3 | 250619T094810Z | Themooni |
| 067 | JavaScript | 250530T001412Z | Miro |
| nan | It should be noted that Uiua actually has a builtin constant containing the colors of the pride flag. That said | 240411T224045Z | noodle p |
| 051 | Raku Perl 6 rakudo | 250422T132409Z | xrs |
| 063 | JavaScript V8 | 250331T110507Z | Steve Be |
| 015 | Uiua | 240918T172420Z | noodle p |
| 285 | tinylisp | 250331T023728Z | Andrew B |
| 064 | zsh | 241001T175545Z | sharvae0 |
| 160 | Python 3 | 240414T211504Z | cnln |
| 062 | Kap | 241015T050937Z | Elias M& |
| 220 | HTML with JavaScript | 241014T223546Z | jan |
| 066 | TinyAPL 0.9.0 | 241014T210120Z | noodle p |
| 148 | Chipmunk Basic | 240605T075324Z | roblogic |
| 028 | Vyxal sḢ | 220317T085648Z | emanresu |
| 089 | Typst | 240719T072035Z | bb94 |
| 088 | JavaScript Node.js | 240718T234140Z | Andrew B |
| 084 | Bash | 240605T090458Z | Themooni |
| 051 | Perl 5 + M5.10.0 | 240412T153401Z | Dom Hast |
| 115 | Bash + Brotli + GNU | 240414T222506Z | Kjetil S |
| 079 | YASEPL | 240405T161347Z | madeforl |
| 028 | Easyfuck | 240330T181757Z | Quadrupl |
| 052 | Uiua | 231018T064754Z | Matthew |
| 345 | PowerShell | 231017T131550Z | Mark Har |
| 323 | GameBoy Color machine code | 231016T192554Z | corvus_1 |
| 026 | 05AB1E | 230609T205552Z | Makonede |
| 289 | Scratch | 220701T200001Z | math sca |
| 116 | dc + QOI | 220626T130238Z | arthomni |
| 071 | Batch | 220417T223009Z | Youserna |
| 246 | Nim | 210627T193521Z | Qaziquza |
| 054 | Big Unicorn | 220322T164603Z | Laurel |
| 075 | Desmos | 220321T232935Z | Aiden Ch |
| 152 | Python 3 with pygame | 220319T183338Z | des54321 |
| 216 | Swift + UIKit | 220317T235855Z | Bbrk24 |
| 045 | R | 210628T151225Z | Dominic |
| 187 | Java 8 | 220317T122546Z | Kevin Cr |
| 069 | C | 210708T182551Z | Ritwin |
| 107 | JavaScript | 210708T153107Z | Shaggy |
| 030 | DOS 80186 .COM executable | 210626T194044Z | EasyasPi |
| 057 | Japt | 210628T141028Z | Shaggy |
| 207 | HTML & CSS — | 210701T212339Z | customco |
| 1502 | R + ggplot2 | 210701T143401Z | Allan_LJ |
| 042 | Postscript | 210701T014613Z | Pertinen |
| 112 | ConTeXt | 210629T023825Z | J. А. de |
| 165 | JavaScript | 210628T205556Z | muka.ger |
| 100 | C | 210628T111944Z | weirdsmi |
| 080 | Python 3 | 210627T004836Z | cnamejj |
| 139 | Wolfram Language Mathematica | 210626T184311Z | theorist |
| 079 | K oK + iKe | 210627T053518Z | Razetime |
| 165 | 210626T162701Z | RGS | |
| 073 | Red | 210626T172822Z | Kirill L |
| 171 | Pygame | 210626T170518Z | user1006 |
| 183 | Python 3 + Turtle | 210626T164949Z | wasif |
| 078 | QBasic | 210626T163145Z | DLosc |
| 245 | HTML | 210626T161502Z | user |
| 164 | TikZ | 210626T160602Z | Wheat Wi |
Brainfuck > out.ppm, 203 bytes
-15: Finally switched from 256 * 6 * 57 to 255 * 6 * 72
>+++++[[-<+>>++<]>]<<[-]<[-]<[-]<.[-]<[-<+>]<------.<.>---.+.----.<.>+++.-.++.<.>--.<.[->++<]>++>>->++>>>++>+>>++>++>>>++>>>>++>+>>++>-<+[-<+]>+[-<<<[>>-[>.>.>.<<<-]<+<-]>>>>>[-]<[-]<[-]<<[>>+<<-]>>>>>+]
This program outputs the contents for a ppm file that looks like this:
First this header of magic number, width, height and color depth is constructed:
P6
340
324
2
or in Ascii codepoints:
[80 54 10 51 52 48 10 51 50 52 10 50 10]
The dimensions have been chosen because they multiply up to 6 * 72 * 255. For the image body, the last 50 and the 10 from the header are recycled into a 72. Queued up color values are then each printed 72 * 255 times.
make 5
>+++++
make a copy and double this until we double 128
[[-<+>>++<]>]
remove the 128 64 and 160
<<[-]<[-]<[-]<
.[-]< print 80
[-<+>]< add 40 to 20
------. 54
<. 10
>---. 51
+. 52
----. 48
<. 10
>+++. 51
-. 50
++. 52
<. 10
>--. 50
<. 10
[->++<]>++ make 72
>>-
> r++>>> o++>+>> y++>++>> g>++>> b>>++> p+>>++>-
< +[-<+] return
> go to red value where the end signal will be
+[-
<<< [ for 72
>> -[ for 255
>.>.>.<<<- print color values
]
<+<- slowly copy 72 to preserve it
]
>>> >>[-]<[-]<[-] << erase printed color
[>>+<<-]>> copy 72 to deleted red value
>>> go to next red value or end signal
+]
Setanta, 139 138 136 bytes
S:=staitse le i idir(0,6){dath@S(['red','orange','bui','glas','gorm','corcra'][i])i*=50cruth_lan@S([[0,i],[450,i],[450,i+50],[0,i+50]])}
AWK, 93 91 88 bytes
END{for(;i++<split("31 33 1;33 32 34 35",a);print s)for(s=X;++x%20;)s=s"\33["a[i]"m█"}
func p(y){ # print function
s=X; # empty string
for(;++x%20;) # until twenty
s=s"\33["y"m█"; # append block
print s} # print final string
END{ # start at end
p(31) # color codes
p(33) #
p("1;33") #
p(32) #
p(34) #
p(35)} #
Commodore 64 Assembler, 36 Bytes (6502/KickAssembler)
Code
* = $f7
rlines: .by $c5,$98,$6b,$3e,$30,$f2 // 6 Rasterlines to change colour on
sei // 1 SYS253: Disable interrupts
lsr $d011 // 3 Screen off (whole screen is border)
again: ldx #5 // 2 Init rasterline & colour index
loop: ldy cols,x // 3 Load colour from table
lda rlines,x // 2 Load rasterline from table
wait: cmp $d012 // 3 Compare to current rasterline
bne wait // 2 Wait until on correct rasterline
sty $d020 // 3 Save colour to border
dex // 1 Decrement table index
bpl loop // 2 Loop until X rolls over
bmi again // 2 X has rolled over, draw flag again
cols: .by 6,5,7,8,2,4 // 6 BLUE,GREEN,YELLOW,ORANGE,RED,PURPLE
Explanation
- Program is started with SYS253.
- First we disable interrupts so that BASIC/KERNAL isn't going to mess up the timing of our code, and then the screen (text/graphics) area, thus the whole screen is displaying just the border colour. We will draw the flag by changing the border colour on a bunch of rasterlines (scanlines).
- In a loop, we load a rasterline from a table on which the next colour change should take place, the colour we should next change the border to, wait until we're on that rasterline, and change the colour. We do this until we've gone through all six values in the tables, and then just do it again on next frame, ad infinitum.
- The code uses a couple tricks that could be considered sizecoding to reduce its size: 1) The rasterlines table is in the beginning, before the code, and the program is loaded partially to the end of the zero page. As the table resides on zero page we can access it with
LDA nn,Xinstead ofLDA nnnn,x, saving a byte. 2) We disable the screen by right-shifting the bits in VIC's config register $d011 instead of loading an appropriate value to e.g. accumulator and storing it to $d011. This saves us two bytes. - VICE C64 emulator displays 272 scanlines when its Border Mode is set to Normal. As this is not divisible by 6, the top and bottom colour bars are a pixel taller than others. Judging by the other answers, this is acceptable.
Bonus (Invalid Answer)
- If we would accept that the coloured areas are not of exactly the same size, we could combine the rasterline and colour information into a single table. C64 has only 16 colours, thus when we store a byte to $d020 to change the border colour, only lo nybble is used from that byte. We can adjust the rasterlines slightly so that the lo nybble of the rasterline contains the colour we want to change to on that rasterline.
- As we have combined the tables and now have only one value to read, we can omit the
ldy cols,x. These changes reduce the program to just 27 bytes. Unfortunately an invalid answer given the rules of the question, but wanted to share it anyway as some may find this table-combining thing interesting.
* = $f7
rlines: .by $c6,$95,$67,$38,$32,$f4 // 6 Rasterlines to change colour on
sei // 1 SYS253: Disable interrupts
lsr $d011 // 3 Screen off (whole screen is border)
again: ldx #5 // 2 Init rasterline & colour index
loop: lda rlines,x // 2 Load rasterline & colour from table
wait: cmp $d012 // 3 Compare to current rasterline
bne wait // 2 Wait until on correct rasterline
sta $d020 // 3 Save colour to border
dex // 1 Decrement table index
bpl loop // 2 Loop until X rolls over
bmi again // 2 X has rolled over, draw flag again
C64 Assembler, 70 bytes
KickAssembler was used for the following code
*=$18fe // start address 6398
sei // disable IRQs
lda #$19 // #$19 = #25 = #%00011001
sta $dc0d // disable Timer A interrupt
sta $0314 // set IRQ address (lo)
sta $0315 // set IRQ address (hi)
sta $d01a // enable raster compare IRQ
sta $d011 // clear "bit 8" of raster compare register
asl // 25*2=50
sta $d012 // set first line for raster IRQ to 50
lda $dc0d // acknowledge any pending CIA IRQ
cli // enable IRQs
rts // return to system
irq: // raster IRQ routine at $1919
inc $d019 // acknowledge raster interrupt
bit $ea // wait 6 cycles
ldx $fb // load raster bar counter
lda color,x // select raster bar color
sta $d021 // set background color
lda line,x // select next line
sta $d012 // set next line for raster IRQ
inx // increment raster bar counter
cpx #6 // compare counter with 6
bcc end // if x<6 jump to end
ldx #0 // else reset raster bar counter to 0
end:
stx $fb // store raster bar counter
jmp $ea31 // jump to standard IRQ handler
color: .byte 2,8,7,5,6,4 // red, orange, yellow, green, blue, purple
line: .byte 83,116,150,183,216,50 // raster IRQ lines
18fe 78 sei
18ff a9 19 lda #$19
1901 8d 0d dc sta $dc0d
1904 8d 14 03 sta $0314
1907 8d 15 03 sta $0315
190a 8d 1a d0 sta $d01a
190d 8d 11 d0 sta $d011
1910 0a asl
1911 8d 12 d0 sta $d012
1914 ad 0d dc lda $dc0d
1917 58 cli
1918 60 rts
1919 ee 19 d0 inc $d019
191c 24 ea bit $ea
191e a6 fb ldx $fb
1920 bd 38 19 lda $1938,x
1923 8d 21 d0 sta $d021
1926 bd 3e 19 lda $193e,x
1929 8d 12 d0 sta $d012
192c e8 inx
192d e0 06 cpx #$06
192f 90 02 bcc $1933
1931 a2 00 ldx #$00
1933 86 fb stx $fb
1935 4c 31 ea jmp $ea31
1938 02
1939 08
193a 07
193b 05
193c 06
193d 04
193e 53
193f 74
1940 96
1941 b7
1942 d8
1943 32
Vyxal 3, 34 bytes
"⎊⌽ɾ0“"0f7"⊢6÷¨"▲Gp⍢2‰y&ḧV ”pᏜ>.+”
-10 bytes with help from emanresu
Vyxal It Online!
click this button:
to display the result as html
"⎊⌽ɾ0“"0f7"⊢6÷¨"▲Gp⍢2‰y&ḧV ”pᏜ>.+”
"⎊⌽ɾ0“ # compressed integer 137352395
⊢ # convert to base...
"0f7" # literal string
6÷ # split into 6 pieces
¨ p # prepend to each color code:
"▲Gp⍢2‰y&ḧV ” # compressed string "<div style=background-color:#"
Ꮬ>.+ # append literal string ">."
” # join on newlines
💎
Created with the help of Luminespire.
JavaScript, 67 bytes
alert("🟥🟧🟨🟩🟦🟪".replace(/./gu,"$&".repeat(9)+`
`))
Adapted from NodeJS answer by Andrew Bayly.
It should be noted that Uiua actually has a built-in constant containing the colors of the pride flag. That said, this solution avoids using this constant by compressing the colors.
Uiua, 25 bytes
▽34≡↯300↯6_3÷2⊥₃282319238
Try it here. Here's the output: (resized to take up less space on the page)
This uses the recently-stabilized function ⊥ base in order to get the colors of the flag.
Uiua's format for images uses has colors as length-3 arrays of numbers between 0 and 1, representing the red, green, and blue components of each pixel. This solution uses a color palette that allows each of these colors to be represented by combinations of 0, 0.5, and 1. The array of colors doubled is all numbers in 0, 1, and 2, which can then be treated as an integer in base-3.
Below is a solution which works in older versions of the language, before the addition of ⊥ base:
Uiua, 34 33 30 29 27 bytes
▽34≡↯300↯6_3⍜⊏÷₂4_15⋯181465
I noticed that the existing Uiua solution used a lot of bytes storing the RGB values of the 6 colors, so I decided to compress those, which is the main reason this is shorter. I chose a color palette just uses 0, 0.5, and 1 as the RGB components of the colors:
red orange yellow green blue purple
color [1 0 0] [1 0.5 0] [1 1 0] [0 1 0] [0 0 1] [0.5 0 1]
hex #ff0000 #ff8000 #ffff00 #00ff00 #0000ff #8000ff
Since there are only two occurrences of 0.5, I decided to store this list by replacing those 0.5s with 1s, read this as binary, and keep track of what the indices of the 0.5s were. This gives the integer 181,465 for the binary, and the (0-based) indices 4 and 15 to be halved:
⋯181465 100110110010001101
4_15 ^ ^
To generate the actual image, the program takes 300 of each color, then 34 of each row.
Raku (Perl 6) (rakudo), 51 bytes
say "\e[{$_}m█"x 20 for <31 38;5;214 33 32 34 35>
Screengrab from terminal:
JavaScript (V8), 63 bytes
_=>[...'🟥🟧🟨🟩🟦🟪'].map(c=>c.repeat(15)).join`
`
Alternative: Javascript, 145 bytes
d=>d.style.background='linear-gradient(to bottom,'+[0,1,2,3,4,5].map(i=>`${c=`hsl(${i*60},70%,40%)`} ${i*99/6}%,${c} ${(i+1)*99/6}%`).join`,`+')'
Given an HTML element (eg, body), sets the background to the rainbow.
Uiua, 11 15 bytes
▽34≡↯300Rainbow
Try it: Uiua pad
Believe it or not, Uiua has a built-in for the colors of the rainbow pride flag! It also has corresponding built-ins for the colors of the transgender, gender-fluid, and many other LGBTQ+ pride flags.
In Uiua 0.14.0, it was renamed from Gay to Rainbow, with Gay being the gay men flag, so this is a bit longer now.
Also see my solution which gets the colors with a more creative idea.
tinylisp, 414 290 285 bytes
(d M(q((C L)(i L(c C(M C(s L 1)))(q(
(d F 40
(d S string
(d Z 129002
(d X(s Z 1
(d W(s X 1
(d V(s W 1
(d Y(s V 1
(d U(s Y 1
(S(M U F
(S(M U F
(S(M U F
(S(M V F
(S(M V F
(S(M V F
(S(M W F
(S(M W F
(S(M W F
(S(M X F
(S(M X F
(S(M X F
(S(M Y F
(S(M Y F
(S(M Y F
(S(M Z F
(S(M Z F
(S(M Z F
zsh, 64 Bytes
p(){echo "\e[$1m${(pl:22::█:)}"};p 91;p 31;p 93;p 32;p 34;p 35
Python 3, 172 160 bytes
from curses import*
s=initscr();start_color();y=1
for x in[9,208,11,10,12,13,0]:w=newwin(2,35,y*2,0);init_pair(y,1,x);w.bkgd(' ',color_pair(y));w.refresh();y+=1
This code uses the Python curses library to display the flag. It loops through XTerm colour values ([9,208,11,10,12,13,0]), creating a new curses window for each band of the flag. The trailing 0 is to ensure the flag displays properly when it is run.
Some optimisations:
- Tabs instead of spaces for indents
- Making use of the semi-colon for combining multiple lines into one
- Uses
cursesimports directly
I still feel there are some slight improvements to be made here, especially with y.
Previous version
import curses as c
s=c.initscr();c.start_color();y=1
for x in [9,208,11,10,12,13,0]:
w=c.newwin(2,35,y*2,0);c.init_pair(y,1,x);w.bkgd(' ',c.color_pair(y));w.refresh();y+=1
Kap - 62 bytes
58 characters
gui:draw⊃⍪(1 0 0)(1 0.6 0)(1 1 0)(0 1 0)(0 0 1)(0.5 0 0.5)
HTML with JavaScript, 220 bytes
paste into file, open in Firefox (or maybe another browser).
Using .match(/.../g) is inspired by @Shaggy
<canvas height="204"></canvas><script>"70f00f0f0ff0f70f00".match(/.../g).entries().forEach(a=>((b=document.getElementsByTagName("canvas")[0].getContext("2d")).fillStyle="#"+a[1],b.fillRect(0,0,300,204-34*a[0])))</script>
TinyAPL 0.9.0, 69 66 bytes
(46 43 chars)
⎕DisplayImage 2÷⍨34⌿⍉◡⍉300⌿∧3‿6⍴3⊤373714568
Try it: TinyAPL REPL
This is the first TinyAPL submission to CGCC! And, probably one of the first TinyAPL programs written by anyone other than RubenVerg, the language's creator :)
Here's the resulting image:
(old screenshot)
Chipmunk Basic, 215 148 bytes
Chipmunk Basic (v368b2.02) on MacOS. Corrected the flag size. Here's an online interpreter.
data 6,0,0,6,4,0,6,6,0,0,3,0,0,0,6,3,0,3
graphics 0:for i=1to 6:h=33*i:read a,b,c
graphics color a*16,b*16,c*16:graphics fillrect 0,h-33,300,h
next
Vyxal sḢ, 49 36 35 31 28 bytes
»qǎ}»H⁽ǔİƛ`<¦₴ «⟇=øḢ-÷¥:#Π>.
Stuff Vyxal isn't meant to do! This took far too long. The Ḣ flag renders stdout as HTML. See the revision history for a version with (slightly) less questionable colours.
Also, here's a bonus one.
ƛ # Over each element of...
⁽ǔİ # All rotations of
»qǎ}»H # "700cff"
`... # Compresssed string `<div style=background-color:#Π>.`
# The Π pops and inserts an item from the stack.
# (s flag) turn the result into something HTML understands
# (Ḣ flag) render the output as HTML
For compression purposes, the character codes are all six rotations of #700cff, which creates something fairly close to a rainbow.
Typst, 102 89 bytes
Produces PDF by default, so scalable.
#stack(..(red,orange,yellow,green,blue,purple).map(c=>box(width:45pt,height:5pt,fill:c)))
JavaScript (Node.js), 122 91 88 bytes
for(i=o='';i<6e3;)o+=++i%100?[...'🟥🟧🟨🟩🟦🟪'][i/1e3|0]:`
`;console.log(o)
My intention was to create a flag with stripes, and minimal artifacts, that would run in Node.js. If you follow the link and Try It Online, then you'll see black bars below each character, however when I run it in Visual Studio Code, I don't see any of those ( see picture ).
Bash, 84 bytes
Happy Pride!
-12 bytes by @alephalpha with golfed color codes
-4 bytes by me by replacing do...done with {...}.
-14 bytes by me by removing quotes
e=(31 33 93 32 34 35)
for c in ${e[@]};{
echo -e "\033[$c"m
printf █%.0s {1..20}
}
image in both kitty and xterm, because my kitty theme has the same color for orange and yellow:

Perl 5 + -M5.10.0, 51 bytes
Outputs using ANSI escape codes.
$#a=35;say map".[48;5;${_}m@a
"x2,9,208,11,46,21,54
Perl 5 + -M5.10.0, 62 bytes
Outputs a 400x300 PPM (P6) image.
say"P6 400 300 9 xx ",map{$_ x2e4}" .. .. ...... ..."=~/.../g
Bash + Brotli + GNU, 115 bytes
echo X438CkDcxr5nOaagFZ4XbMDxiLutTyxjsAFXkm2wvRmJbpNuxxww8pgDFu6YA0okjzkgHo854AFTNdQxB5wD|base64 -d|brotli -d>x.ppm
The output file x.ppm can be viewed in any decent image viewer. For instance a Chrome web browser.
YASEPL, 99 97 79 bytes
I'm not sure if this counts, but it still does make a pride flag
it uses ANSI because YASEPL doesn't support image creating (..yet)
=i£1©196©214©226©46©26©129`1=h$27›¥i,1!q$91›#48$59›#5›#h#"m";" ",40<<!+}2,6
Easyfuck, 28 bytes
Húܸß~¼bSHY\PLDk_.yvCä+APC]PAD)NBHESANBH␁¢
due to lack of unicode representations for c1 control characters, they have been replaced by their superscripted abbreviations
Decompressed:
$>[KF}}<1++H[->.<]H>!.>]@␊08<␌␃"
Explanation:
$>[KF}}<1++H[->.<]H>!.>]@␊08<␌␃"
$> copy 1st cell to storage, move to 2nd
[ ] while loop
KF}} set color according to value of current cell, then set current cell to 60 (█)
<1++H go to previous cell, set it to 18, and change to alternative charpage
[ ] while loop
->.< print next cell while decrementing the current one
H> go back to normal charpage, then go to the next cell
!.> set it to storage, print, and move to the next cell
@ return
␊08<␌␃" initializer data (new line, red, orange, yellow, green, blue, purple)
Uiua, 52 bytes
⍉⍉↯400⍉⬚50▽[]÷4[4_0_0 4_2_0 4_4_0 0_4_0 0_0_4 3_0_4]
÷4[4_0_0 4_2_0 4_4_0 0_4_0 0_0_4 3_0_4] # Set up the colours
(RGB values between 0 and 1)
⬚50▽[] # Make an array of 50 of each RGB value
⍉ # Transpose the array
↯400 # Repeat each element 400 times
⍉⍉ # Transpose to the correct format
(300x400x3)
A couple of bytes can be saved by making the image 40px by 30px. This can be done by removing a zero from each of "400" and "50" in the code above.
PowerShell, 345 bytes
$a='System.Windows.Forms'
Add-Type -AssemblyName $a
$Form=New-Object "$a.Form"
$l=0
$c=@('red','orange','yellow','green','blue','indigo')
foreach($s in $c){
$t=New-Object "$a.Label"
$t.Size=New-Object System.Drawing.Size(100,10)
$t.Location=New-Object System.Drawing.Point(0,$l)
$t.BackColor=$s
$form.Controls.Add($t)
$l+=10
}$Form.ShowDialog()
Output
No doubt that this can be improved upon!
GameBoy Color machine code, 323 bytes
00000000 22 0d 20 fc c9 1f 00 1f 02 ff 03 e0 03 00 7c 10 |". ...........|.|
00000010 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |@...............|
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000100 3e 88 e0 68 1e 06 2e 05 2a e0 69 2a e0 69 f0 68 |>..h....*.i*.i.h|
00000110 c6 06 e0 68 1d 20 f1 3e 01 e0 4f 11 06 20 21 00 |...h. .>..O.. !.|
00000120 98 4a c7 3c 1d 20 fa 76 00 00 00 00 00 00 00 00 |.J.<. .v........|
00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000140 00 00 00 c0 |....|
00000144
The code could be a lot shorter, but a Gameboy ROM needs the value 0xC0 at byte 0x143 to indicate it's a GameBoy Color ROM. The ROM only works on Gearboy.
While the GBC only had screen resolution of 160 x 144 pixels, Gearboy quadruples it by default, so that each pixel is 4 times as large.
The binary was generated from this assembler code:
; ONLY WORKS ON GEARBOY
DEF rVBK EQU $ff4f
DEF rBCPS EQU $ff68
DEF rBCPD EQU $ff69
SECTION "Rst $0", ROM0[$0]
; @param a value
; @param hl pointer
; @param c count
MemsetSmall::
ld [hli], a
dec c
jr nz, MemsetSmall
ret
SECTION "Data", ROM0[$5]
Colors:
; 15-bit RGB values
; BBBBB GGGGG RRRRR
DW %00000_00000_11111
DW %00000_10000_11111
DW %00000_11111_11111
DW %00000_11111_00000
DW %11111_00000_00000
DW %10000_00000_10000
SECTION "Entrypoint",ROM0[$100]
Entrypoint:
; set background palette
ld a, %10001000
ldh [rBCPS], a
ld e, 6
ld l, LOW(Colors)
.load_color
ld a, [hli]
ldh [rBCPD], a
ld a, [hli]
ldh [rBCPD], a
; skip other 3 colors of this palette
ldh a, [rBCPS]
add 6
ldh [rBCPS], a
dec e
jr nz, .load_color
ld a, 1
ldh [rVBK], a
ld de, (32 << 8) | 6
ld hl, $9800
.draw_stripe
ld c, d
rst MemsetSmall
inc a
dec e
jr nz, .draw_stripe
halt
SECTION "HEADER", ROM0[$0143]
DB $c0
Scratch, 289 bytes
when gf clicked
add(16753920)to[l v
add(16776960)to[l v
add(65280)to[l v
add(255)to[l v
add(8388736) to [l v
set pen color to(()+(16711680
set pen size to(800
pen down
repeat(5
change[a v] by (1
go to x:(-240)y:((150)-((60)*(a
set pen size to(60
set pen color to(item(a)of[l v
set x to(240

dc + QOI, 116 bytes
16i[qoif]P0dPP1P32P0ddPPPCCP3P0P5AP[A7[FDP1-d0<R]dsRxF0Pk]ddddddxFEPFFP80P0PxFEPFFdPP0Px7APx6DPx5APx0ddddddPPPPPPP1P
Outputs a 306x204 image to stdout in the Quite OK Image Format (shown here converted to png):
QOI images can be viewed with ImageMagick, among other software:
dc -e"16i[qoif]P0dPP1P32P0ddPPPCCP3P0P5AP[A7[FDP1-d0<R]dsRxF0Pk]ddddddxFEPFFP80P0PxFEPFFdPP0Px7APx6DPx5APx0ddddddPPPPPPP1P" | magick display
Batch, 71 bytes
@set n=m█^&@echo ␛[m
@echo ␛[31%n%␛[33%n%␛[93%n%␛[32%n%␛[34%n%␛[35%n%
␛ represents the nonprintable character.
Nim, 862 274 246 bytes
var
y=33.0
m=newImage(297,198)
c=newContext(m)
r=y/2
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(vec2(0,r),vec2(y*9,r)));r+=y;m.writeFile("l.png")
Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know. This answer has gone through a lot of revisions, from totally un-golfy to fairly golfed. Bytes were counted using wc -c.
Big Unicorn, 54 bytes
C1P9T1P2T1C7P9T3P2C2T3P9T1P2T1C9P9T3P2T3C3P9T1P2T1C8P9
Unicorns sure do love rainbows...
Desmos, 75 bytes
k=255
C=rgb([k,k,k,0,0,75],[0,165,k,k,0,0],[0,0,0,0,k,k])
[5...0]<y<[6...1]
Technically, each colored bar has the same area of infinity, but if that's not allowed, then you can simply add a domain restriction at the end of the inequality with the cost of some additional bytes.
Try It On Desmos! - Prettified
There must be some way to golf that huge rgb() expression, but I don't see a way at the moment...
Bonus Answer, 5 bytes
pride
If you paste pride into an empty expression, Desmos will automatically redirect you to a graph of the pride flag.
Python 3 with pygame, 166 152 bytes
I wrote this before realizing there was another pygame answer here, but I'm still posting it because I wrote it independently, and it does use a rather different method for getting the colors.
from pygame import*
d=display
s=d.set_mode()
for i in range(6):
draw.rect(s,("red","orange","yellow","green","blue","purple")[i],(0,i*3,32,3))
d.flip()
Edit -14 bytes: Some golfing I did on another pygame answer I just posted helped me golf this one too.
New output:
As the size makes this almost illegible, here's a scaled up version (from the older code, hence the window bar at the top) for better viewing:
Swift + UIKit, 216 bytes
A function that returns a UIView.
func f()->UIView{let v=UIStackView(arrangedSubviews:[UIColor]([.red,.orange,.yellow,.green,.blue,.purple]).map{let v=UIView()
v.backgroundColor=$0
return v})
v.axis = .vertical
v.distribution = .fillEqually
return v}
You can't remove the whitespace around the last two = operators.
Result when displayed at full screen on iPhone Xʀ:

Swift + SwiftUI, 90 bytes
A View. Not a function that returns one -- you could say let prideFlag = /* the answer */, or include the answer directly in a ViewBuilder.
VStack(spacing:0){Color.red
Color.orange
Color.yellow
Color.green
Color.blue
Color.purple}
This is why everyone prefers SwiftUI.
The colors are slightly different, and it doesn't let itself extend into the margins at the top/bottom of the screen, but the result is very similar:

R, 80 65 45 bytes
image(t(1:6),c=rainbow(12)[c(10,8,4:1)],ax=F)
Original 80-byte version
plot(0,,,1:2,c(1,7),,,,"","",,F);rect(1,7:2,2,6:1,,,rainbow(12)[c(1:4,8,10)],NA)
Java 8, 191 187 bytes
import java.awt.*;v->new Frame(){public void paint(Graphics g){for(int i=0;i<6;g.fillRect(0,i++*35+30,300,35))g.setColor(new Color(i<3?255:i/5*143,i==1?200:i/2%2*255,i/4*255));}{show();}}
Result:
Explanation:
import java.awt.*; // Required import for Frame/Graphics/Color
v-> // Method with empty unused parameter and Frame return
new Frame(){ // Create a Frame (window for graphical output)
public void paint(Graphics g){
// Overwrite its default paint method:
for(int i=0;i<6 // Loop `i` in the range [0,6):
; // After every iteration:
g.fillRect( // Draw the rectangle
0,i++*35+30, // at x,y position 0,35i+30, where the `+30` is
// to account for the title-bar
300,35)) // of 300 pixels wide and 35 pixels high
// (so the entire flag is 300x210)
g.setColor(new Color(i<3?255:i/5*143,i==1?200:i/2%2*255,i/4*255));}
// Change the RGB-color based on `i`:
// i=0 (red): 255, 0, 0
// i=1 (orange): 255,200, 0
// i=2 (yellow): 255,255, 0
// i=3 (green): 0,255, 0
// i=4 (blue): 0, 0,255
// i=5 (violet): 143, 0,255
{ // And in an inner initializer block:
show();}} // Show the frame
C, 69 bytes
I don't have comment privileges yet, so I'm adding this as another answer. This is an improvement on @weirdsmiley's answer.
#define p(s)puts("\e["#s"m█");
main(){p(91)p(31)p(93)p(32)p(34)p(35)}
I added the the \e[ and m to the p macro because it was used 6 times in each macro invocation. Also the \e[0m (which resets the color) can be removed because the color is overwritten again before each puts.
If there was a way to make the 91 and 93 start with a 3, then it might save a few bytes by being able to remove the 3 from the 30s.
I'm new to codegolf, so I'm sure if this is 69 or more bytes (because of the █ character).
JavaScript, 107 bytes
console.log(`%c `.repeat(6),...`f00fa0ff00f000fb0b`.match(/.../g).map(c=>`background:#${c};padding:2%26%`))
Open your browser's console and run the snippet below.
console.clear()
console.log(`%c `.repeat(6),...`f00fa0ff00f000fb0b`.match(/.../g).map(c=>`background:#${c};padding:2%26%`))
DOS 80186 .COM executable, 31 30 bytes
xxd:
00000000: b0 13 cd 10 68 00 a0 07 31 ff be 18 01 ac b9 80 ....h...1.......
00000010: 2a f3 aa 3c 05 75 f6 c3 28 2a 2c 02 20 05 *..<.u..(*,. .
Commented assembly:
; NASM syntax
[cpu 186]
[org 0x100]
start:
; Set DOS to mode 13h for 320x200, 256 colors
; Since we know the DOS startup state, we can just set AL.
mov al, 0x13 ; 0x0013
int 0x10
; Set ES to point to the video ram segment
push 0xa000
pop es
; Set DI to point to the start of video ram
xor di, di
; Set SI to our lookup table
mov si, colors
.loop:
; Load color from lookup table
lodsb
; Roughly 1/6 of the screen
; ceil(200 / 6) * 320
mov cx, 10880
; For all CX iterations, store byte to video ram
rep stosb
; Check for last byte in lut and loop if it is not
; that.
cmp al, 5
jnz .loop
.ret:
; Return to DOS, leaving a pretty but annoying flag on
; the screen that requires a manual mode reset.
ret
; Lookup table for the default 256 color palette.
colors:
; R O Y G B P
db 40, 42, 44, 2, 32, 5
I'm not sure if this is valid, as the last stripe is technically a bit shorter than the others, but 200 is not a multiple of 6 so it is unavoidable at this size.
Screenshot (the C:\CODE> part is simply the DOS prompt overwriting it after exiting)
- 1 byte:
stosbalready stores to theessegment. What a dummy.
Japt, 91 57 bytes
The latest entry in my series of making Japt do things it shouldn't be able to do!
Ol"%c "²³$,...$`fÇÛÆèÆÇ¾b`roT ò3 Ëi`padÜA:2%26%;baå®":#
Test it (Open your browser's console. Only tested in Chrome.)
Original solution
$flags$
`fÇÛÆèÆÇ¾b`roT ò3 £$V.before(V.cloneNode(),V.style.border=V.style.background='#'+X
HTML & CSS — 207 bytes
hr{height:30px;margin:0;border:0}hr{background:red}*+hr{background:orange}*+*+hr{background:yellow}*+*+*+hr{background:green}*+*+*+*+hr{background:blue}*+*+*+*+*+hr{background:violet}
<hr><hr><hr><hr><hr><hr>
R + ggplot2,150 bytes - https://cran.r-project.org/web/packages/ggplot2/index.html
library(ggplot2);ggplot(data.frame(y=1:6),aes(y=y))+theme_void()+geom_bar(fill=c("#9400D3","#0000FF","#006400","#FFFF00","#FFA500","#FF0000"),width=1)
Postscript, 42 bytes
Hand tokenised (42 bytes including showpage, 40 bytes without).
00000000: 36 88 09 32 5b 30 20 2e 31 92 38 30 88 f7 88 f7 6..2[0 .1.80....
00000010: 5d 7b 8e 05 88 33 3c e3 00 7d 8d 00 33 20 63 6f ]{...3<..}..3 co
00000020: 6c 6f 72 69 6d 61 67 65 92 a1 lorimage..
No tokenisation (62 bytes including showpage, 53 bytes without):
6 9 2[0 .1 .1 0 -9 -9]{<88333ce30>}false 3 colorimage
showpage
This renders to about 3.2 by 2.1 cm (0.8" by 1.25"). The size is limited by the constants '.1'. Making the flag bigger requires a smaller number which will need one extra byte (two bytes in the untokenised version).
The tokenised version is the same as the untokenised version except the ".1 .1" is encoded as ".1 dup" to save a byte.
ConTeXt, 112 bytes
It produces PDF, hence scalable, output:
\startMPpage for i=0upto5:draw(0,-i)--(5,-i)withcolor hsvtorgb(i*(25+6i),1,1)withpen pensquare;endfor\stopMPpage
JavaScript - 165 bytes
The snippet works in the console.
console.log(...["red","orange","#ff0","green","#00f","violet"].reduce((a,c)=>{a[0]=a[0]+'%c0';return [...a,`background:${c};color:${c};padding:35px 400px;`];},['']))
EDIT:
Used Chrome Version 91.0.4472.114 (Official Build) (x86_64) for creating the image.
C, 171 bytes 118 bytes 100 bytes
EDIT: Saved 53 bytes thanks to Wheat Wizard and 14 bytes thanks to ceilingcat
#define p(s) printf(#s"█\e[0m\n");
main(){p(\e[91m)p(\e[31m)p(\e[93m)p(\e[32m)p(\e[34m)p(\e[35m)}
Try on godbolt!
NOTE: Output differs a little according to Godbolt's UI.
Here is the output from my native machine.
Python 3, 108 89 85 80 bytes
print("P3 300 204 9")
for x in range(6):print(*"900960990070009707"[x::6]*10200)
Huge change (-22 chars) thanks to ovs, and -5 more from Wheat Wizard!
The output is an ASCII PPM image file, which is easy to generate but incredibly inefficient space-wise. So even at 300x204 pixels it's too larger for TIO, so it's truncated if you run the code there.
Here's an explanation.
print("P3 300 204 9") # Print the PPM header (1)
for x in range(6): ... # For each distinct color
... print(*"900960990070009707"[x::6]*10200) # Print 10200 copies of the RGB value (2)
(1) - P3 means it's an RGB image, 300 204 are the dimensions and the last number if the max RGB value 9 in this case so that we can use single digit values.
(2) - The RGB values are single byte since the color depth in the header is given as 9. The string 900960990070009707 holds the 3 digit RGB values for each of the 6 rows.
The image uploader won't accept a PPM file so I loaded it into GIMP and exported it as a PNG to include it.
Wolfram Language (Mathematica), 142 139 bytes
BarChart[1~Table~6,BarOrigin->Left,ChartStyle->{Purple,Blue,Green,Yellow,Orange,Red},BarSpacing->0,Axes->0>1,ChartBaseStyle->EdgeForm@None]
ChartBaseStyle->EdgeForm@None removes the faint black lines that would normally separate each bar.
-3 bytes thanks to att.
K (oK) + iKe, 79 bytes
w:300
h:200
{(0,x*34;,("red";"#fa0";"#ff0";"#0f0";"#00f";"#808")x;(34;w)#0)}'!6
Draws a static bitmap with 300x200px area.
SVG, 254 bytes HTML, 181 173 165 bytes
By moving from SVG to HTML, I can get away with not specifying a bunch of things and leaving some tags open.
- Saved ~ 70 bytes thanks to Wheat Wizard.
- Saved 8 + 8 bytes thanks to pxeger.
<svg><rect y=0 fill=red /><rect y=1 fill=#fa0 /><rect y=2 fill=#ff0 /><rect y=3 fill=#4f0 /><rect y=4 fill=blue /><rect y=5 fill=#808><style>rect{width:8px;height:1px
After zooming in a lot, you can see
Red, 73 bytes
view/tight[style s: box 315x35 below s red s#fa0 s#ff0 s#0f0 s#00f s#808]
Works in Red console. To run as a standalone program, we must add in front:
Red[needs view]
I don't know, whether this has to be counted.
Pygame, 171 bytes
from pygame import*
d=display
e=99
s=d.set_mode((e*9,e*6))
m=[255]
l=[0]
i=0
for c in[m+l*2,m+[e]+l,m*2+l,l+m+l,l+l+m,[e,0,e]]:draw.rect(s,c,(0,i*e,e*9,e));i+=1
d.update()
Python 3 + Turtle, 183 bytes
from turtle import*
for x in "red orange yellow green blue violet".split():fillcolor(x);begin_fill();exec("fd(200);lt(90);fd(20);lt(90);"*2);end_fill();rt(90);fd(20);lt(90)
mainloop()
The turtle pointer by default starts at cartesian coordinates (0,0) so the image is in the 4th quadrant.
QBasic, 78 bytes
SCREEN 9
FOR i=0TO 5
READ c
LINE(0,i*40)-(400,239),c,BF
NEXT
DATA 4,6,14,2,9,5
The orange looks more like brown, in my opinion, but it's the closest QBasic has (it's the dark version of yellow). Here's the output when run on DOSBox at Archive.org:
HTML, 330 245 bytes
Saved 7 bytes thanks to Wheat Wizard!
Saved 78 bytes thanks to Recursive Co.!
<div style="background:red"> </div><div style="background:#F60"> </div><div style="background:#CF0"> </div><div style="background:#0F0"> </div><div style="background:blue"> </div><div style="background:#C0F"> </div>
TikZ, 164 bytes
\documentclass[tikz]{standalone}\begin{document}\tikz{\foreach\u\c in{1/purple,2/blue,3/green,4/yellow,5/orange,6/red}{\fill[\c](,\u)rectangle(9,7);}}\end{document}
Pretty simple.
\documentclass[tikz]{standalone}\begin{document}\tikz{ % boilerplate
% For every color and index ascending from the bottom.
\foreach\u\c in{1/purple,2/blue,3/green,4/yellow,5/orange,6/red}{
% Draw a filled rectangle in that color from (0,u) to the upper right corner
\fill[\c](,\u)rectangle(9,7);
}
}\end{document} %boilerplate














































