# Draw the national flag of France

There have been many other flag challenges posted but not one for the national flag of France. This week seems like an appropriate time.

Produce this flag in the fewest bytes possible:

• The image must be in a ratio of 3:2, with size at least 78 pixels wide and 52 pixels tall.
• Each stripe takes up one third of the width.
• The stripe colors from left to right are RGB: (0, 85, 164), (255, 255, 255), (239, 65, 53).
• The image can be saved to a file or piped raw to STDOUT in any common image file format, or it can be displayed.
• Alternatively, output a block of text at least 78 characters wide made of non-whitespace characters that depicts the flag, using ANSI color codes to color it. (Use standard blue, white, and red.)
• Built-in flag images/libraries are not allowed.

The shortest code in bytes wins.

The Stack Snippet at the bottom of this post generates the leaderboard from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

## Language Name, N bytes


where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes


If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes


You can also make the language name a link which will then show up in the snippet:

## [><>](http://esolangs.org/wiki/Fish), 121 bytes


<style>body { text-align: left !important} #answer-list { padding: 10px; width: 290px; float: left; } #language-list { padding: 10px; width: 290px; float: left; } table thead { font-weight: bold; } table td { padding: 5px; }</style><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table><script>var QUESTION_ID = 64140; var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk"; var OVERRIDE_USER = 42156; var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page; function answersUrl(index) { return "https://api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER; } function commentUrl(index, answers) { return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER; } function getAnswers() { jQuery.ajax({ url: answersUrl(answer_page++), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { answers.push.apply(answers, data.items); answers_hash = []; answer_ids = []; data.items.forEach(function(a) { a.comments = []; var id = +a.share_link.match(/\d+/); answer_ids.push(id); answers_hash[id] = a; }); if (!data.has_more) more_answers = false; comment_page = 1; getComments(); } }); } function getComments() { jQuery.ajax({ url: commentUrl(comment_page++, answer_ids), method: "get", dataType: "jsonp", crossDomain: true, success: function (data) { data.items.forEach(function(c) { if (c.owner.user_id === OVERRIDE_USER) answers_hash[c.post_id].comments.push(c); }); if (data.has_more) getComments(); else if (more_answers) getAnswers(); else process(); } }); } getAnswers(); var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/; var OVERRIDE_REG = /^Override\s*header:\s*/i; function getAuthorName(a) { return a.owner.display_name; } function process() { var valid = []; answers.forEach(function(a) { var body = a.body; a.comments.forEach(function(c) { if(OVERRIDE_REG.test(c.body)) body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>'; }); var match = body.match(SCORE_REG); if (match) valid.push({ user: getAuthorName(a), size: +match[2], language: match[1], link: a.share_link, }); else console.log(body); }); valid.sort(function (a, b) { var aB = a.size, bB = b.size; return aB - bB }); var languages = {}; var place = 1; var lastSize = null; var lastPlace = 1; valid.forEach(function (a) { if (a.size != lastSize) lastPlace = place; lastSize = a.size; ++place; var answer = jQuery("#answer-template").html(); answer = answer.replace("{{PLACE}}", lastPlace + ".") .replace("{{NAME}}", a.user) .replace("{{LANGUAGE}}", a.language) .replace("{{SIZE}}", a.size) .replace("{{LINK}}", a.link); answer = jQuery(answer); jQuery("#answers").append(answer); var lang = a.language; lang = jQuery('<a>'+lang+'</a>').text(); languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang.toLowerCase(), user: a.user, size: a.size, link: a.link}; }); var langs = []; for (var lang in languages) if (languages.hasOwnProperty(lang)) langs.push(languages[lang]); langs.sort(function (a, b) { if (a.lang_raw > b.lang_raw) return 1; if (a.lang_raw < b.lang_raw) return -1; return 0; }); for (var i = 0; i < langs.length; ++i) { var language = jQuery("#language-template").html(); var lang = langs[i]; language = language.replace("{{LANGUAGE}}", lang.lang) .replace("{{NAME}}", lang.user) .replace("{{SIZE}}", lang.size) .replace("{{LINK}}", lang.link); language = jQuery(language); jQuery("#languages").append(language); } }</script>

• Those RGB values don't match your image. From what I see, you've got RGB: (0, 35, 149), (255, 255, 255), (237, 41, 57). Nov 18, 2015 at 0:18
• Storing the specified palette compactly is probably the trickiest part of this problem in most languages. Given that, it seems rather unfair to graphical solutions to permit ANSI output with a standard palette. Why not permit graphical solutions to use pure (0, 0, 255)/(255, 255, 255)/(255, 0 0) to level the playing field? Nov 18, 2015 at 0:19
• Each stripe takes up one third of the width. Might be more interesting to use the Naval variant: by a regulation dated 17 May 1853, the navy went back to using the 30:33:37 proportions, which it now continues to use, as the flapping of the flag makes portions farther from the halyard seem smaller. Nov 18, 2015 at 0:19
• echo 🇫🇷 not quite big enough Nov 18, 2015 at 4:08
• @JohnE I agree. The rules on colors give the ASCII-art solutions a massive advantage. They also don't make the challenge any more "difficult" (merely adds bytes really) for the languages that can use arbitrary colors and disqualifies several cool languages that can't do arbitrary colors. Nov 18, 2015 at 22:26

## ZX Spectrum BASIC, 10 bytes

(including the final end-of-line)

This does not fulfil the minimum flag size requirement, but I like this version, because it is so nice and compact. Please take it as a non-competing entry.

The hexadecimal dump is: F5 22 10 01 8A 10 02 8A 22 0D

Explanation:

PRINT is a keyword and takes one byte, 0xF5, its graphical representation includes the spaces around. The ZX Spectrum BASIC has one-byte colour codes, introduced by the 0x10 code for the foreground - 01 is for blue, 02 for red. 0x8A is a pseudographical character "▌", the left part of which is displayed in either blue or red.

The colours are of course from the standard ZX Spectrum palette - please adjust your PAL TV if the RGB values are not displayed quite correctly.

Despite the seemingly text mode of the program, the output is fully (bitmapped) graphical, as can be seen by looking into the VideoRAM. Thus there is no need to comply with the ANSI codes requirement, which the ZX does not support anyway (it has superior INK and PAPER commands).

• Any chance of a link to an emulator/interpreter?
– user45941
Nov 21, 2015 at 12:45
• Presumably a full flag would me something like FOR i=SGN PI TO PI*PI+PI+PI: PRINT "<blue ink>[8 blocks]","<red ink>[8 blocks]": NEXT i
– Neil
Nov 22, 2015 at 23:20

void mainImage(out vec4 o,vec2 i){float x=i.x/iResolution.x*3.0;vec3 w=vec3(255,255,255);o=vec4((x<1.0?vec3(0,85,164):x<2.0?w:vec3(239,65,53))/w,1);}


See it here

Not particularly exciting. I'm sure there are ways to golf it more; I'll take a crack when I get home.

• The link redirects to shadertoy.com/error :/ Nov 19, 2015 at 0:38

## Powershell, 173 bytes, 170 bytes,155 bytes, 97 bytes!

$i=26;$y=0;function w($c){for($x=0;$x -le$i; $x++){write-host -noNewLine "F" -ForegroundColor$c}}for($x=0;$x -le $i;$x++){w("blue");w("white");w("red");write-host '';}


sal q write-host;$i=26;$y=0;function w($c){for($x=0;$x -le$i; $x++){q -noNewLine F -ForegroundColor$c}}for($x=0;$x -le $i;$x++){w("blue");w("white");w("red");q '';}


(Thanks to Cole Johnson for saving me 15 bytes):

sal q write-host;$i=26;function w($c){for($x=0;$x -le $i;$x++){q -noNewLine F -ForegroundColor $c}}for($x=0;$x-le$i;$x++){w("blue");w("white");w("red");q} (Thanks Steve for saving me 58 bytes!!!) sal q write-host;function w($c){1..26|%{q -noNewLine F -Foreground $c}}1..26|%{w(9);w(7);w(12);q}  Output: My first code golf, so I hope I didn't do something wrong. • You could trim six bytes by removing the spaces before $x++ (2) and the spaces in $x -le$i (4) making the for declaration for($x=0;$x-le$i;$x++). Four more bytes by replacing q ''; at the end with just q. Also, where is $y used? Removing $y=0 will save you another four. Screenshot of edit Nov 20, 2015 at 6:13
• Get rid of $i and make use of 1..26|%{....}, dropping you from 155 bytes to just 115. sal q write-host;function w($c){1..26|%{q -noNewLine F -ForegroundColor $c}}1..26|%{w("blue");w("white");w("red");q} Nov 24, 2015 at 23:10 • Save 5 more by replacing ForegroundColor with the shorter Foreground. Nov 24, 2015 at 23:21 • Lose the wordy color descriptions too, use numbers. All the above then gives you 97 bytes (yay, we broke the 100 barrier!) sal q write-host;function w($c){1..26|%{q -noNewLine F -Foreground $c}}1..26|%{w(9);w(7);w(12);q} Nov 24, 2015 at 23:28 • How about @("█"*26)*30|%{sal w write-host;w$_ -f 9 -n;w $_ -n;w$_ -f 4} at 63 bytes Dec 18, 2015 at 23:58

# x86 machine code, 34 bytes

00000000  68 00 b8 07 bb 40 1f 31  ff 83 e7 f0 89 d8 25 00  |h....@.1......%.|
00000010  f1 c1 c3 04 f6 c4 f0 74  f0 b1 1b f3 ab 85 ff 7f  |.......t........|
00000020  eb c3                                             |..|
00000022


Link to the .COM file - runs just fine in DOSBox:

Notice that it doesn't hang after drawing - it's just that the prompt is left in blue not to ruin the result; you can quit from DOSBox as usual with exit, it'll work even if you don't see it while typing.

Commented assembly:

    ; usual .COM boilerplate
org 100h

section .text

start:
; point the ES segment to the graphics memory
push 0x0b800
pop es
; bx is used (mainly) as repository for the background colors
; 1 => blue; f => white; 4 => red; 0 => flag for new row
mov bx,0x1f40
; reset the destination pointer
xor di,di
newrow:
; === start of a new row ===
; round down DI to multiples of 16, to avoid overflowing the row by one
; character (27*3 = 81, while the row is 80 characters)
and di,0xfff0
span:
; === start of a span ===
mov ax,bx
; adjust the pattern in AX:
; - keep the upper byte (background color);
; - leave blue as foreground color at the very end (avoid the prompt
;   ruining the flag when we exit);
; - put NUL as character to display;
and ax,0xf100
; rotate bx, to switch to the next color pattern
rol bx,4
; check if we got to the sentinel value (=> we finished one row)
test ah,0xf0
; in this case, go back to newrow; this will re-align DI and do a new
; rotation on BX
jz newrow
; fill the video memory with 27 times the word built above in AX
mov cl,27
rep stosw
; continue as far as DI is positive; notice that this way we keep writing
; well past the 25 lines limit, but doesn't seem to impact anything
test di,di
jg span
; otherwise exit; the point of this thing is to avoid a wraparound, which
; ends up unaligned, thus breaking the drawing
ret

• It's backwards. And I don't think the color are right. Nov 24, 2015 at 1:34
• @ThomasKwa: sorry, order fixed; the colors are what the nearest that are available in the default VGA palette. Nov 24, 2015 at 1:36

## Marbelous, 122 bytes

@0
--34
=0Ro
\/@0
:Ro
}0
..1B'['0'm0A
Bl1B'['4'1'm
Bl1B'['4'7'm
Bl1B'['4'4'm
{0
:Bl
@0
--1A
=0PS
&0@0
}0
&0
{0
:PS
}0
{0'F


Main board calls Ro 52 times. Ro prints one row including 3 color codes, 3 blocks of spaces, 1 color reset, 1 newline. Bl prints 26 spacesFs. PS prints one space F.

# Befunge-98, 170 bytes

a"552"a"25 87"a"3P"ck,dd+20pv
_v#p02:-1g02,k8"0 85 164 "  <
v>d6*20p#4
<_v#p02:-1g02,k3"255 "
v >dd+20p
>" 35 56 932"9v>
_v#p02:-1g02,k<^
a<v_@#p29:-1g29,
v >"<"00pdd+20p


Outputs the image in PPM format. It's probably still not optimal.

## Unix Shell, 57 bytes.

for i in {a..z}
do printf ␛[4%-28s 4m 7m 1m
echo ␛[m
done


The escapes are in the script literally. On most color terminals you can change 47 to 107 to get a brighter white, but that's not ANSI standard. The script ends up being 61 bytes then. The 28 rather than 26 is because the color code 'steals' two characters from the field width.

Obligatory xxd dump:

0000000: 666f 7220 6920 696e 207b 612e 2e7a 7d0a  for i in {a..z}.
0000010: 646f 2070 7269 6e74 6620 1b5b 3425 2d32  do printf .[4%-2
0000020: 3873 2034 6d20 376d 2031 6d0a 6563 686f  8s 4m 7m 1m.echo
0000030: 201b 5b6d 0a64 6f6e 65                    .[m.done


On a terminal that supports 8-bit control codes it can be made slightly shorter, for 55 bytes.

0000000: 666f 7220 6920 696e 207b 612e 2e7a 7d0a  for i in {a..z}.
0000010: 646f 2070 7269 6e74 6620 9b34 252d 3238  do printf .4%-28
0000020: 7320 346d 2037 6d20 316d 0a65 6368 6f20  s 4m 7m 1m.echo
0000030: 9b6d 0a64 6f6e 65                        .m.done


EDIT: It has come to my attention that ANSI-based solutions are required to draw text in non-white space characters. I have a solution of 65 characters that does so, but I would like someone to explain the reason for the requirement before I post it.

• Can you share an xxd dump or base64 decode of this? Nov 18, 2015 at 16:25
• @DigitalTrauma I really don't think that should be necessary for only two characters where it's perfectly clear where and what they are, but fine. Nov 18, 2015 at 16:59
• Thanks - I asked because it wasn't working for me when copied from this page. It works great with the xxd dump. I think the markdown is translating ␛to 0xe2909b, instead of the necessary 0x1b. Nov 18, 2015 at 18:52
• @DigitalTrauma I deliberately placed the ␛ symbol to indicate the presence and location of the escape characters, I intended for anyone trying to run this to use their editor's mechanism (^V, ^Q, etc) to replace them with literal escapes. Placing literal escapes on the answer itself caused them not to show up at all. Nov 18, 2015 at 18:54
• This doesn't use the correct RGB values, does it? Nov 18, 2015 at 22:17

## CBM BASIC 7.0, 76 bytes

1fOi=1to26:?"r←";:goS3:?"e";:goS3:?"£";:goS3:?:nE:end
3fOj=1to26:?" ";:nE:reT


Note that in line 1, the characters between the quotation marks are PETSCII control codes which actually appear in reverse video on a real Commodore computer:

• r enables reverse video
• ← changes the text colour to blue
• e changes the text colour to white
• £ changes the text colour to red

It's not strictly ANSI, as specified in the question, but given the hardware limitations I think it's close enough. :)

Here is an excerpt of the output on a Commodore 128 80-column display:

# Javascript, 91 bytes

Not the most exciting one.

This one only works on Google Chrome. Current version is 46.0.2490.86m.

console.log((Z='%c▮')+Z+Z,(X='font-size:100px;color:#')+'0055a4','color:#fff',X+'ef4135')

This draws the flag in the console.

Google Chrome has a pure white background for the console, and the default font weight allows it to have 33% of it's width.

This uses the BLACK VERTICAL RECTANGLE character to produce the output.

If you don't have Google Chrome, here's the output:

As an alternative, with 84 bytes:

console.log((Z='%c█')+Z+Z,(X='font-size:9cm;color:#')+'0055a4',X+'fff',X+'ef4135')

This one uses the FULL BLOCK UTF8 character (\xDC in ASCII).

It produces a ~13x9cm flag on Chrome's console.

And this is the result:

## QBASIC, 88 122 Bytes

SCREEN 13
h=200
a=100
PALETTE 2,856123
PALETTE 1,2626816
LINE(0,0)-(a,h),1,BF
LINE(a,0)-(h,h),15,BF
LINE(h,0)-(300,h),2,BF


Edit: As was correctly pointed out, the colors did not meet the requirements. The corrected version is basically as close as one can get in QB as far as I know, since RGB in mode 13 are represented by 18 bits instead of 24 bit. The colors are (0,85,162), (255,255,255), (239,65,52). So blue is ever so slightly off the mark, but close enough I would say.

Here is it in QB64 (it's getting autoformatted there, but it's the same code):

• You could make the image slightly smaller (e.g. 96x64) to save a few bytes. The colors aren't quite right, though. Nov 19, 2015 at 23:37
• @primo You are right about the colors. I fixed them as best as possible at the cost of 34 bytes. In the spirit of the underlying occasion of this challange, I ignore the possible 3 saved bytes for the increased size.
– Jens
Nov 20, 2015 at 1:45

# CSS, 86 bytes

This creates a simple border around the body element:

body{border-left:2cm solid #0055a4;width:2cm;height:4cm;border-right:2cm solid #ef4135

This renders a 6x4cm flag, and should work on any file.

To test on a clean page, paste this on your address bar:

data:text/html,<style>body{border-left:2cm solid #0055a4;width:2cm;height:4cm;border-right:2cm solid #ef4135

URL-encoded:

data:text/html,%3Cstyle%3Ebody%7Bborder-left%3A2cm%20solid%20%230055a4%3Bwidth%3A2cm%3Bheight%3A4cm%3Bborder-right%3A2cm%20solid%20%23ef4135

• You could use a variant of the lobotomized owl selector and replace that body with *>* (or its not as cool cousin, * *) to save 1 byte. Also, you could remove the spaces before hex colors and save another 2 bytes off that. That's a total of 83 bytes: *>*{border-left:2cm solid#0055a4;width:2cm;height:4cm;border-right:2cm solid#ef4135 Aug 13, 2017 at 2:32

## Python, 223 208 bytes

Thanks @Sp3000

from turtle import*
def D():fill(1);fd(100);rt(90);fd(200);rt(90);fd(100);rt(90);fd(200);rt(90);fill(0)
lt(180)
fillcolor("#0055a4")
D()
fillcolor("white")
goto(100,0)
D()
fillcolor("#ef4135")
goto(200,0)
D()


Try it here

• Put the entire D function on one line, with semicolons separating each call. That'll shave off 10 bytes. Get rid of the extraneous space between the last setpos and its arguments for an extra byte.
– user45941
Nov 18, 2015 at 5:06
• This also doesn't work.
– user45941
Nov 18, 2015 at 5:08
• You can remove the space between import and * Nov 18, 2015 at 13:24
• @Mego now it does. Nov 18, 2015 at 19:12
• @undergroundmonorail it ha already been removed. Nov 18, 2015 at 19:13

## Java, 156 bytes

enum F{;public static void main(String[]a){String b="[3";for(int i=0;i<'࿘';i++)System.out.print((i%78<26?b+4:(i%78>51?b+1:b+7))+(i%78>76?"m#\n":"m#"));}}


Used some old tricks like the unicode char used as an int in the loop and so earning a character (but not a byte), modulos (so there's only one loop) and some ternary expressions.

Nothing really special else.

• Feel free to revert if you want; I removed your character count because this question is scored by bytes. Nov 24, 2015 at 1:40

## Perl, 90, 50 + 2 (-p flag) = 52 bytes 44 + 2 (-p flag) = 46 bytes

As nobody's done a Perl version yet, here we go:

$=sprintf "%c[44m%27s%c[47m%27s%c[41m%27s%c[40m\n",27,' ',27,' ',27,' ',27;print$ x 26;

$x=' ' x 27;$_="^[[44m$x^[[47m$x^[[41m$x^[[40m\n" x 26 $x=' 'x26;$_="^[[44m$x^[[47m$x^[[41m$x^[[0m\n"x26


Hexdump:

00000000: 2478 3d27 2027 7832 363b 245f 3d22 1b5b  $x=' 'x26;$_=".[
00000010: 3434 6d24 781b 5b34 376d 2478 1b5b 3431  44m$x.[47m$x.[41
$.+=26}}  Sample output: # C-Sharp, 4608, 1312, 687, 606 bytes Thanks for your comments and suggestions. This is actually my first "published" piece of code ever! have been learning for about two-and-a-half months. class P { static void Main(string[] args) { int l = 0; while (l < 24) { int B = 0; int R = 0; int W = 0; while (B < 26) { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.Write(" "); B++; } while (W < 26) { Console.BackgroundColor = ConsoleColor.White; Console.Write(" "); W++; } while (R < 26) { Console.BackgroundColor = ConsoleColor.Red; Console.Write(" "); R++; } Console.WriteLine(); l++; } Console.BackgroundColor = ConsoleColor.Black; Cons‌​ole.ReadKey();}}  • You've still got a few more spaces to get rid of. In addition, I don't believe the namespace is necessary (I could be mistaken), and all of your variables (as well as the class name and namespace name, if it's necessary) should be shortened to one-character names. – user45941 Nov 19, 2015 at 16:45 • Remember, your entry does not have to be human-readable. Just simple search-and-replace makes your entry fit in a comment: class P{static void Main(string[] args){int l=0;while(l<24){int B=0;int R=0;int W=0;while(B<26){Console.BackgroundColor=ConsoleColor.DarkBlue;Console.Write(" ");B++;}while(W<26){Console.BackgroundColor=ConsoleColor.White;Console.Write(" ");W++;}while(R<26){Console.BackgroundColor=ConsoleColor.Red;Console.Write(" ");R++;}Console.WriteLine();l++;}Console.BackgroundColor=ConsoleColor.Black;Console.ReadKey();}}. Can't help you with C# specific tricks, though. Nov 19, 2015 at 19:45 • The using keyword would help you shave off a lot of bytes. If you put "using C=System.Console;" at the top of your code you can replace every occurrence of Console by C. Similarly for ConsoleColor. Nov 20, 2015 at 9:16 • Assign your three variables in one statement: int B=0;int R=0;int W=0; -> int B=0,R=0,W=0; (-8 bytes). Convert your outer while loop to a for (-2 bytes). Only saves a few bytes, but everything counts. Nov 21, 2015 at 6:58 • Some more tips: Don't use 3 separate loops, instead: using b=System.ConsoleColor; foreach (var c in new[] { b.DarkBlue, b.White, b.Red }). Use composite formatting to output 26 spaces in one go: using a=System.Console; a.Write("{0,26}", ' ');. Doing this, and implementing the other's tips, I was able to cut it down to 210 bytes! Nov 24, 2015 at 13:51 ## Octave, 58 bytes The online Octave interpreter seems to scale up by default, so the Octave answer is rather short, especially since you can use inline assignment. imshow([c=cat(3,[0 m=255 239],[85 m 65],[164 m 53]);c]/m);  ## MATLAB, 70 bytes Since I'm not entirely sure if it's just the online interpreter doing the scaling or whether that's an actual language feature in my Octave answer, here's my MATLAB version as well: m=255;c=cat(3,[0 m 239],[85 m 65],[164 m 53]);imshow([c;c]/m,'I',6e3);  I stands for InitialMagnification. # JavaScript 206 175 c=c.getContext('2d') d=c.createImageData(w=78,h=52),a=Int32Array(d.data.buffer) for(i=w*h;i--;)a[i]=-[6007552,1,13286929][i%w/26|0] c.putImageData(d,0,0) <canvas id=c></canvas> Here's something just for fun. The code can be modified to make all images on a page the french flag. function france(g){ var c =document.createElement('canvas') var x = c.getContext('2d'); var w = c.width = g.width; var h = c.height = g.height; var d = x.createImageData(w,h); var a = new Int32Array(d.data.buffer); var s = w / 3; for(var i=w*h;i--;)a[i]=-[6007552,1,13286929][i%w/s|0]; x.putImageData(d,0,0); g.src = c.toDataURL(); } function allFrance() { var g = document.getElementsByTagName("img"); for(var i = g.length; i--;) france(g[i]); } allFrance()  • use c instead of document.getElementById('c'). Also remove the new  keyword. Nov 21, 2015 at 19:48 • Thansk @ןnɟuɐɯɹɐןoɯ it worked! Nov 21, 2015 at 21:24 # FLTK, 234 199 bytes Function{}{}{Fl_Window{}{xywh{9 9 78 52}}{Fl_Box{}{xywh{0 0 26 52}box FLAT_BOX color 0x0055a4ff}Fl_Box{}{xywh{26 0 26 52}box FLAT_BOX color 7}Fl_Box{}{xywh{52 0 26 52}box FLAT_BOX color 0xef4135ff}}}  Ungolfed: Function {} {} { Fl_Window {} { xywh {9 9 78 52} } { Fl_Box {} { xywh {0 0 26 52} box FLAT_BOX color 0x0055a4ff } Fl_Box {} { xywh {26 0 26 52} box FLAT_BOX color 7 } Fl_Box {} { xywh {52 0 26 52} box FLAT_BOX color 0xef4135ff } } }  Sample output: ## Python 2, 46 bytes s="[3%s;1m"+"#"*26;print(s%4+s%7+s%1+"\n")*30  There is a non-printable ESC character at the beginning of the format string: $ hexdump -C f.py
00000000  73 3d 22 1b 5b 33 25 73  3b 31 6d 22 2b 22 23 22  |s=".[3%s;1m"+"#"|
00000010  2a 32 36 3b 70 72 69 6e  74 28 73 25 34 2b 73 25  |*26;print(s%4+s%|
00000020  37 2b 73 25 31 2b 22 5c  6e 22 29 2a 33 30        |7+s%1+"\n")*30|
0000002e


Coloured space character version:

s="[3%s;7m"+" "*26;print(s%4+s%7+s%1+"\n")*30


## Tiny version, 44 bytes

Doesn't fit for the "at least 78 chars wide" requirements.

s="[3%s;7m"+" "*9;print(s%4+s%7+s%1+"\n")*9


# CJam, 43

'P[Z"s<h8_.KUw'rFa"158b256b3/(\30f*60*]e_N*


Outputs an image in PPM format. Try it online

## C#, 176 bytes as a Program

A program that outputs the Full Block character 219, 78 wide, 52 tall. If your font is square, this will have the correct ratio.

using System;class P{static void Main(){for(int x,y=52;y-->0;)for(x=4;x-->1;Console.Write(new string('█',26)+(x<2?"\n":"")))Console.ForegroundColor=(ConsoleColor)(x%3*3+9);}}


Indentation and new lines for clarity:

using System;
class P{
static void Main(){
for(int x,y=52;y-->0;)
for(x=4;x-->1;Console.Write(new string('█',26)+(x<2?"\n":"")))
Console.ForegroundColor=(ConsoleColor)(x%3*3+9);
}
}


## C#, 157 bytes as a Function

I argue that the requirements did not require a program and that a function would suffice. In that case, I can drop the byte count substantially.

using System;void F(){for(int x,y=52;y-->0;)for(x=4;x-->1;Console.Write(new string('█',26)+(x<2?"\n":"")))Console.ForegroundColor=(ConsoleColor)(x%3*3+9);}


Indentation and new lines for clarity:

using System;
void F(){
for(int x,y=52;y-->0;)
for(x=4;x-->1;Console.Write(new string('█',26)+(x<2?"\n":"")))
Console.ForegroundColor=(ConsoleColor)(x%3*3+9);
}

• Nice logic, but it doesn't compile (even after correcting the parameters to your string constructor). You need to add a class, and static void Main, leaving you with 177 bytes. Nov 24, 2015 at 14:04
• @Berend, there was no requirement to have a full program. Even so, I'll add that option. And whoops on me for stuffing up the string! Nov 24, 2015 at 22:04