# Generate an RGB colour grid

This! is an RGB colour grid...

Basically it's a 2-dimensional matrix in which:

• The first row, and the first column, are red.
• The second row, and the second column, are green.
• The third row, and the third column, are blue.

Here are the colours described graphically, using the letters R, G, and B.

Here's how we calculate the colour of each space on the grid is calculated.

• Red + Red = Red (#FF0000)
• Green + Green = Green (#00FF00)
• Blue + Blue = Blue (#0000FF)
• Red + Green = Yellow (#FFFF00)
• Red + Blue = Purple (#FF00FF)
• Green + Blue = Teal (#00FFFF)

# The Challenge

• Write code to generate an RGB colour grid.
• It's code golf, so attempt to do so in the smallest number of bytes.
• Use any programming language or markup language to generate your grid.
• The result should graphically display an RGB grid with the defined colours.
• Things I don't care about:
• If the output is an image, HTML, SVG or other markup.
• The size or shape of the colour blocks.
• Borders, spacing etc between or around the blocks.
• It definitely doesn't have to have labels telling you what the row and column colours should be.
• Can we output an mage object native to our language, for example a Bitmap object in C#? – Embodiment of Ignorance Apr 16 '19 at 21:13
• @EmbodimentofIgnorance sounds fine to me. – AJFaraday Apr 16 '19 at 22:08
• I'm waiting for the solution in Piet – manassehkatz-Reinstate Monica Apr 17 '19 at 0:25
• @manassehkatz Is it just possible that hard-coding the data would be better golf than executing it? – AJFaraday Apr 17 '19 at 8:09
• Not that it really matters, but I'd personally have used cyan and magenta instead of teal and purple (or anything else). As far as I know, these are the official terms used in printing or subtractive color models such as CMYK. – Arnauld Apr 19 '19 at 7:26

printf "${f=^[[3%dm.}$f$f " 1 3 5 3 2 6 5 6 4 Here, blocks are . characters. ^[ is a literal ASCII escape character (0x1b). You can recreate this script as follows: base64 -d <<< cHJpbnRmICIke2Y9G1szJWRtLn0kZiRmCiIgMSAzIDUgMyAyIDYgNSA2IDQ= > rgbgrid.sh • what the heck? please explain :) – flawr Apr 17 '19 at 7:28 • can save 2 bytes using shell expansion printf${f=\\e[3%dm.}$f$f\\n 1 3 5 3 2 6 5 6 4 – Nahuel Fouilleul Apr 17 '19 at 7:28