g | x | w | all
Bytes Lang Time Link
203Brainfuck > out.ppm240918T152115Zjan
136Setanta240719T194004Zbb94
088AWK241105T194137Zxrs
nanCommodore 64 Assembler250622T204226ZJani Joe
070C64 Assembler250622T164710ZOSI8
034Vyxal 3250619T094810ZThemooni
067JavaScript250530T001412ZMiro
nanIt should be noted that Uiua actually has a builtin constant containing the colors of the pride flag. That said240411T224045Znoodle p
051Raku Perl 6 rakudo250422T132409Zxrs
063JavaScript V8250331T110507ZSteve Be
015Uiua240918T172420Znoodle p
285tinylisp250331T023728ZAndrew B
064zsh241001T175545Zsharvae0
160Python 3240414T211504Zcnln
062Kap241015T050937ZElias M&
220HTML with JavaScript241014T223546Zjan
066TinyAPL 0.9.0241014T210120Znoodle p
148Chipmunk Basic240605T075324Zroblogic
028Vyxal sḢ220317T085648Zemanresu
089Typst240719T072035Zbb94
088JavaScript Node.js240718T234140ZAndrew B
084Bash240605T090458ZThemooni
051Perl 5 + M5.10.0240412T153401ZDom Hast
115Bash + Brotli + GNU240414T222506ZKjetil S
079YASEPL240405T161347Zmadeforl
028Easyfuck240330T181757ZQuadrupl
052Uiua231018T064754ZMatthew
345PowerShell231017T131550ZMark Har
323GameBoy Color machine code231016T192554Zcorvus_1
02605AB1E230609T205552ZMakonede
289Scratch220701T200001Zmath sca
116dc + QOI220626T130238Zarthomni
071Batch220417T223009ZYouserna
246Nim210627T193521ZQaziquza
054Big Unicorn220322T164603ZLaurel
075Desmos220321T232935ZAiden Ch
152Python 3 with pygame220319T183338Zdes54321
216Swift + UIKit220317T235855ZBbrk24
045R210628T151225ZDominic
187Java 8220317T122546ZKevin Cr
069C210708T182551ZRitwin
107JavaScript210708T153107ZShaggy
030DOS 80186 .COM executable210626T194044ZEasyasPi
057Japt210628T141028ZShaggy
207HTML & CSS —210701T212339Zcustomco
1502R + ggplot2210701T143401ZAllan_LJ
042Postscript210701T014613ZPertinen
112ConTeXt210629T023825ZJ. А. de
165JavaScript210628T205556Zmuka.ger
100C210628T111944Zweirdsmi
080Python 3210627T004836Zcnamejj
139Wolfram Language Mathematica210626T184311Ztheorist
079K oK + iKe210627T053518ZRazetime
165210626T162701ZRGS
073Red210626T172822ZKirill L
171Pygame210626T170518Zuser1006
183Python 3 + Turtle210626T164949Zwasif
078QBasic210626T163145ZDLosc
245HTML210626T161502Zuser
164TikZ210626T160602ZWheat 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:

A 340 by 324 pride flag

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]])}

Try at try-setanta.ie

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█"}

Attempt This Online!

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)

Screenshot from VICE C64 Emulator

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

Bonus (Invalid Answer)

Ever so slightly wonky flag

* = $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

enter image description here

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   

Try in emulator

Vyxal 3, 34 bytes

"⎊⌽ɾ0“"0f7"⊢6÷¨"▲Gp⍢2‰y&ḧV ”pᏜ>.+”

-10 bytes with help from emanresu

Vyxal It Online! click this button: html 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.

Try it on Flems

Output: A UI alert with a textual flag

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)

Screenshot of pride flag generated by the program

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

Try it!

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>

Attempt This Online!

Screengrab from terminal:

enter image description here

JavaScript (V8), 63 bytes

_=>[...'🟥🟧🟨🟩🟦🟪'].map(c=>c.repeat(15)).join`
`

Try it online!

enter image description here

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.

enter image description here

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

Try it online!

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

Screenshot of a terminal window showing the pride flag

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:

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)

Try in the browser

Screenshot

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)

screenshot of REPL, showing the flag

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

enter image description here

Vyxal sḢ, 49 36 35 31 28 bytes

»qǎ}»H⁽ǔİƛ`<¦₴ «⟇=øḢ-÷¥:#Π>.

Try it Online!

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.

enter image description here

         ƛ     # 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)))

Pride flag generated by Typst code

JavaScript (Node.js), 122 91 88 bytes

for(i=o='';i<6e3;)o+=++i%100?[...'🟥🟧🟨🟩🟦🟪'][i/1e3|0]:`
`;console.log(o)

Try it online!

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 ).

Pride Flag from VS Code

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}
}

Attempt This Online!

image in both kitty and xterm, because my kitty theme has the same color for orange and yellow: enter image description here

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

Try it online!


Perl 5 + -M5.10.0, 62 bytes

Outputs a 400x300 PPM (P6) image.

say"P6 400 300 9 xx ",map{$_ x2e4}"	..	..		......	..."=~/.../g

Try it online!

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

image of pride flag in console with ANSI

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]

Try it online!

               ÷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)

Pride flag made in Uiua language

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.

However, the result is not great: Tiny pride flage made in Uiua

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()

Can't run in the browser 😔

Output

enter image description here

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

screenshot from Gearboy

05AB1E, 26 bytes

„P3ƵÈDY•2Ûm¤Ç{wÕ•3ôŽwÓ×S»»

Try it online! Outputs as a plain PPM.

Output

Pride flag

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

Code image

Try it online! | Test it on Scratchblocks!

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):

Pride flag output

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.

An image of the pride flag created by my code.

Big Unicorn, 54 bytes

C1P9T1P2T1C7P9T3P2C2T3P9T1P2T1C9P9T3P2T3C3P9T1P2T1C8P9

Unicorns sure do love rainbows...

pride flag on grid of white

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]

Result:

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!

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.

You have a chance of getting this graph:

Or this graph:

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:

A mostly black screen with a very small rainbow flag in the top left

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:

A window displaying a 6-stripe pride flag

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ʀ:

1

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:

2

R, 80 65 45 bytes

image(t(1:6),c=rainbow(12)[c(10,8,4:1)],ax=F)

Try it at rdrr.io!

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)

Try it at rdrr.io!

enter image description here

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:

enter image description here

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)}

Try it on godbolt

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)

enter image description here

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

Test it

HTML & CSS — 207 bytes

enter image description here

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)

the output image enter image description here

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.

GSView window redering Postscript pride flag

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

enter image description here

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;`];},['']))

enter image description here

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.

enter image description here

Python 3, 108 89 85 80 bytes

print("P3 300 204 9")
for x in range(6):print(*"900960990070009707"[x::6]*10200)

Try it online!

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.

enter image description here

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.

enter image description here

K (oK) + iKe, 79 bytes

w:300
h:200
{(0,x*34;,("red";"#fa0";"#ff0";"#0f0";"#00f";"#808")x;(34;w)#0)}'!6

Try it online!

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.

<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

enter image description here

Red, 73 bytes

view/tight[style s: box 315x35 below s red s#fa0 s#ff0 s#0f0 s#00f s#808]

enter image description here

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()

Here's the flag generated: enter image description here

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()

enter image description here

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:

QBasic flag output

HTML, 330 245 bytes

Saved 7 bytes thanks to Wheat Wizard!

Saved 78 bytes thanks to Recursive Co.!

<div style="background:red">&nbsp;</div><div style="background:#F60">&nbsp;</div><div style="background:#CF0">&nbsp;</div><div style="background:#0F0">&nbsp;</div><div style="background:blue">&nbsp;</div><div style="background:#C0F">&nbsp;</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

Result