Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Today is November 8th, 2016, Election Day in the United States of America.

If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do not discuss who you voted for. It only matters that you voted.

If you are not a U.S. citizen or not eligible to vote, then, before answering this challenge, do the U.S. a favor by telling anyone you know who is an eligible citizen to go out and vote if they haven't already.

Challenge

Write a program that indicates that you voted, like a digital "I Voted" sticker.

It should take no input and must output in a reasonable way the phrase I Voted where the I, o, and e are red (#FF0000) and the V, t, and d are blue (#0000FF). The background must be white (#FFFFFF).

For example:

"I Voted" example graphic

These colors are of course representative of the American flag (though not the official colors). Red comes first simply because it comes first in the common idiom "red white and blue".

To be valid, an answer must:

  • Use the colors specified in the arrangement specified.

  • Use a single legible font and font size. The example uses 72pt Times New Roman bold but any common font above 6pt is probably fine.

  • Have just the phrase I Voted on a single line, capitalized correctly, with a clear space between the two words. It shouldn't look like IVoted.

  • Not indicate who the answerer voted for or supports for president or any down-ballot races. Let's not start any internet debates. This is about celebrating voting, not candidates.

Any reasonable way of displaying or producing the output is valid, such as:

  • Drawing the text to an image that is then displayed, saved, or output raw.

  • Writing the text to a console using color formatting. In this case you may approximate pure red and blue if necessary, and it's ok if only the area directly behind the text can be made white.

  • Displaying the text on a WPF/Windows form.

  • Outputting an HTML/RTF/PDF file with the text.

Please post an image of your output.

The shortest answer in bytes wins.

share|improve this question
24  
A bit disappointed my actual sticker doesn't look like yours. – Geobits 2 days ago
31  
"It only matters that you voted." - @HelkaHomba ... That's like saying "it doesn't matter what code you write, as long as you wrote some code." :/ – Michael Yaeger 2 days ago
33  
@MichaelYaeger Well, writing some code is better than writing none. Voting is better than not voting. Chances are people will put some thought into coding and voting if they choose to do it. But really I said that to help avoid angry debates. – Calvin's Hobbies 2 days ago
28  
If it helps anyone, vowels are red, consonants are blue. – mbomb007 2 days ago
22  
@mbomb007 Or more usefully, the letters with odd code points are red, and the letters with even code points are blue. – Sp3000 2 days ago

40 Answers 40

C, 82 80 78 bytes

Thanks to @WillihamTotland and @criptych for saving 2 bytes each!

#define a"\33[47;31m"
#define b"\33[34m"
f(){puts(a"I"b" V"a"o"b"t"a"e"b"d");}

Output on my phone:

share|improve this answer
87  
+1 for golfing on phone – TùxCräftîñg 2 days ago
3  
@KritixiLithos that line defines a as "\x1B[%dm", which is an ANSI escape sequence for coloring, with a placeholder. The numbers in printf() fill those placeholders. – betseg 2 days ago
1  
Two bytes can be shaved off by replacing a with "\x1B[47;31m" and defining b to "\x1B[34m", then using puts with alternating a and b prefixes. – Williham Totland yesterday
3  
You can save another 2 bytes with "\33" instead of "\x1B". – criptych yesterday
1  
@yellowantphil I tried making an hexdump but it didn't work, can you please post a dump with 0x1B (escape character)? – betseg 23 hours ago

Minecraft Chat (vanilla 1.10 client, spigot 1.10 server): 19 bytes

&4I &1V&4o&1t&4e&1d

or from the clientside:

§4I §1V§4o§1t§4e§1d

Minecraft uses a color coding system with these colors programmed in.

enter image description here

Mind the rules:

  • Writing the text to a console using color formatting. In this case you may approximate pure red and blue if necessary, and it's ok if only the area directly behind the text can be made white.

All of these are true, as:
the red and blue ARE approximations (though still very similar).
The background in Minecraft chat is transparent, meaning that it's possible to put this on a white background. (such as an empty world)

share|improve this answer
4  
Wow. I'm speechless. That's a very clever answer! – DrMcMoylex 2 days ago
14  
I don't think Minecraft Chat is Turing-complete or considered a programming language (although this may no longer be a requirement). Very creative though! :) – Shebang 2 days ago
3  
@Shebang gaming.stackexchange.com/questions/20219/… Minecraft chat has (nearly) all the same commands as command blocks, and certainly all the commands from back when the question was asked :-) – tuskiomi 2 days ago
1  
@HelkaHomba your screenshot! – tuskiomi 2 days ago
8  
Technically, in vanilla Minecraft, the &s should be §s – Oliver 2 days ago

Google Blockly, 10 14 blocks, 28 41 35 blytes

Code

enter image description here

Output

enter image description here

Try it here

Not counting the hide turtle block because it's just aesthetics.

A blyte is a combination of a block and a byte, there's no meta post yet as how to count this, but I'll create one later. As for now, this is how I count:

  • I o e, 8 blytes
  • V t d, 10 blytes (2 leading spaces here)
  • Colours, 1 blyte each, 2 total
  • 90, 2 blytes
  • 999, 3 blytes
  • 0, 1 blyte
  • turn right, 2 blytes
  • move forward, 2 blytes
  • normal blocks, 1 blyte each, 5 total

Since Google Blockly is rarely used for golfing and I'm thinking waaay outside of the box for this challenge, I hope this is a valid submission.

share|improve this answer
10  
For the record this is valid. It's nice to see unique languages. Though, unless there's a meta concensus on byte-counting in Google Blockly, I may ignore it when selecting a winner. – Calvin's Hobbies 2 days ago
2  
You may find discussion here relevant. CC @HelkaHomba. – Scimonster 2 days ago

HTML, 52 bytes

I <c>V<e>o<c>t<e>e<c>d<style>*{color:red}c{color:0ff
share|improve this answer
2  
Also, I think that #FF0000 -> #F00 and #0000FF -> #00F works – Conor O'Brien 2 days ago
1  
Actually there is a constant for #F00: red. – manatwork 2 days ago
30  
Why not turn this into a Stack Snippet? – Neil 2 days ago
3  
<r>I <c>V<r>o<c>t<r>e<c>d<style>r{color:red}c{color:blue works – ASCII-only 2 days ago
6  
actually you can just keep nesting without closing I <c>V<e>o<c>t<e>e<c>d<style>*{color:red}c{color:0ffand note change to blue 0ff – user21677 2 days ago

Windows 10 Batch, 51 50 bytes

@color fc&echo I ␛[94mV␛[91mo␛[94mt␛[91me␛[94md␛[m

Where ␛ represents the ANSI Escape 0x1B character. Outputs using colour formatting. Edit: Saved 1 byte thanks to @brianush1. I tried writing the code to generate this but it took 97 bytes. Output:

I voted

share|improve this answer
    
You can golf it down by 1 byte if you use @color fc&echo I... – brianush1 2 days ago
    
interesting, I didn't realise Windows terminal supported ANSI escape sequences – Mark K Cowan yesterday
1  
@MarkKCowan It's only Windows 10, and (I think!) post Redstone Update. It's one of the few things that stop me from just installing XP over it. – wizzwizz4 yesterday

LaTeX, 147 126 bytes

\documentclass{proc}\input color\begin{document}\def\z{\color{red}}\def\y{\color{blue}}\z I \y V\z o\y t\z e\y d\end{document}

Saved 21 bytes and got better kerning thanks to @AndreïKostyrka.

This prints an a4 page with this on the first line (note that this also prints page 1 on the bottom):

enter image description here

share|improve this answer
7  
I would have thought LaTeX would typeset the Vo kerning prettier... But apparently it considers each letter separately due to the colours. – sanchises 2 days ago
    
@sanchises Since each letter is in a separate command, I think it destroys proper kerning. – Fatalize 2 days ago
    
Yeah exactly. Although I'm sure it would be possible somehow if golfing was not a requirement. – sanchises 2 days ago
    
@sanchises this is definitely possible, but this is indeed longer than this ugly solution. – Fatalize 2 days ago
    
+1 for LaTeX. Rarely seen here – BrainStone yesterday

JavaScript, 71 bytes

console.log('%cI %cV%co%ct%ce%cd',r='color:red',b='color:blue',r,b,r,b)

Makes use of console.log's ability to print in color. Doesn't work in a stack snippet so you should paste this answer to the console to test it.

enter image description here

Picture credits to @Mast

share|improve this answer
    
That's exactly what I just came up with, haha. I think the shortest alternative would be console.log([...' I Voted'].join`%c`,r='color:red',r,b='color:blue',r,b,r,b) – ETHproductions 2 days ago
    
Doesn't work in Node.js either. :( – Jordan 2 days ago
    
I was surprised this actually works, but it does. – Mast 2 days ago
    
In Node, you could do console.log("q[47mq[91mI q[91mVq[94moq[91mtq[94meq[91md"), replacing each q with the literal char \x1B for 57 bytes. – ETHproductions 2 days ago

LÖVE, 152 142 136 bytes

Let's show some löve for a fun little prototyping language! It's not perfect for the task of golfing (c'mon, it's LUA based), but it's easy to write.

function love.draw()l=love.graphics
a=255
l.setBackgroundColor(a,a,a)s=l.setColor
p=l.print
s(a,0,0)p('I   o e')s(0,0,a)p('  V  t d')end

Screenshot:

screenshot


Fully ungolfed version:

function love.draw()
    love.graphics.setBackgroundColor(255,255,255)
    love.graphics.setColor(255,0,0)
    love.graphics.print('I   o e')
    love.graphics.setColor(0,0,255)
    love.graphics.print('  V  t d')
end
share|improve this answer
7  
I löve that you used something other than Java. – TimmyD 2 days ago
2  
So many 255… A variable for them? – manatwork 2 days ago
1  
@cat They just don't. It's not like I'm overprinting them on a console, it's a graphical print. So a space here is just "paint nothing in this area", not "paint this area background colored". – Geobits 2 days ago
1  
Can't you remove the alpha parameter while setting the colour, like l.setBackgroundColor(a,a,a)? – Kritixi Lithos yesterday
1  
+1 for using Ubuntu :) – Rudolf L. Jelínek yesterday

R, 113 85 81 74 73 55 bytes

Edit: Saved a bunch of bytes thanks to @rturnbull and @JDL

plot(8:1,0:7*0,pc=el(strsplit("detoV  I","")),co=2:1*2)

The size of the output (and spacing etc) depends on the resolution of the currently open graphics device. Tested in RGui and RStudio on my monitor and produces:

enter image description here

share|improve this answer
2  
Oh, I've never seen el() before. Thanks for helping me learn more R! Since text is vectorized, you can skip the for-loop and just write: text(seq(.3,.6,.05),.5,s,col=c("red","blue")). (I modified your x positions for golfier code, although the spacing may be a little less neat.) – rturnbull 2 days ago
1  
Also, thanks to partial argument matching you can use co= rather than col=. And finally, 6:12*.05 is several bytes shorter than seq(.3,.6,.05). – rturnbull 2 days ago
1  
Good catch! And now I realize that 6:12/20 is of course 1 byte shorter than 6:12*.05, apologies for leading you astray and suggesting suboptimal edits. – rturnbull 2 days ago
1  
Aren't the colours off? Shouldn't the "I" and "V" be different colours? – JDL 2 days ago
    
If the colours aren't wrong, then plot(7:1,0:6/Inf,pc=el(strsplit("detoV I","")),co=1:2*2) is 56 bytes. – JDL 2 days ago

Mathematica (REPL image output), 65 bytes

Row[Style@@@({Characters@"I Voted",{a=Red,a,b=Blue,a,b,a,b}})]

Graphical REPL expression. The Unicode character is U+F3C7 (private use) for \[Transpose].

share|improve this answer
3  
"Private use?" What is that? – Conor O'Brien 2 days ago
1  
@ConorO'Brien enwp.org/Private_Use_Areas – LegionMammal978 2 days ago

MATLAB, 74 bytes

We create a white 50x50 (one column for each state) background using imshow of an array of ones. We then display a text, using my trick of shortening property names to get the colours. Since the default font is not fixed width, the text is padded with spaces.

imshow(ones(50))
text(2,9,'I   o e','Co','r')
text(8,9,'V  t  d','Co','b')

enter image description here

MATLAB, 99 bytes, fixed width font

The first version uses fiddling with spaces and coordinates to get a proper kerning on the default font, and might not display properly on your computer. Instead, we can use a fixed width font, like Courier (or, for some more bytes, FixedWidth which works on any system that has a fixed width font installed). This does come at the cost of quite a few extra bytes. We can mitigate this slightly by using a for loop to print the text. The text and corresponding colours are stored in a cell array. The background needs to be a little bit larger.

imshow(ones(80))
for y={'I  o e ','  V t d';'r','b'}
text(9,9,y{1},'Co',y{2},'FontN','Courier')
end

enter image description here

Matlab, 83 bytes bonus edition

Sadly, underlined blue text is not allowed. Otherwise, this answer would have highlighted some interesting behaviour in MATLAB. You can print red text using fprintf(2,txt), and you can print blue underlined text with fprintf('<a href="">txt</a>'). Combining this works... sometimes. Completely at random, it may also create red underlined text. You can issue drawnow between consecutive f calls if this is the case on your system.

f=@(p)fprintf(2,'%s<a href="">%s</a>',p(1:end-1),p(end));f('I V');f('ot');f('ed');fprintf('\n')

enter image description here

share|improve this answer
    
You can write <a href> instead of <a href="">. If you don't like it, you can use <a href=#>. – Ismael Miguel 11 hours ago
    
@IsmaelMiguel Clever. <a> didn't work. – sanchises 9 hours ago

Hot Soup Processor, 48 bytes

color 255
mes"I  o e
pos,0
color,,-1
mes"  V t d

The ungolfed version is:

color 255,0,0
mes "I  o e"
pos 0,0
color 0,0,255
mes "  V t d"

If you bear in mind that mes (message) is HSP's echo, I think this is fairly readable.

Weirdly, if you try to do pos or pos,, the blue line doesn't overwrite the red line and appears beneath it. Even weirder, color is only meant to take values in 0-255, but 0,0,-1 works for blue, 0,-1,0 works for green and -1,0,0 works for... black? (-257,0,0 and 511,0,0 work for red though, so something's funky about the mod 256 going on)

enter image description here

share|improve this answer
    
Why don't the spaces in the second mes overwrite the first? – cat 2 days ago
    
@cat Spaces don't actually draw anything, it just advances the cursor position in a sense – Sp3000 2 days ago
    
Clever using -1 for 255. Have a +1 – Cyoce yesterday

PowerShell v2+, 71 59 57 bytes

[char[]]"I Voted"|%{Write-Host -b w -n -f (9,12)[$_%2]$_}

Saved two bytes thanks to @flashbang

Takes "I Voted" and turns it into a char-array, then loops |%{...}. Each letter, we execute Write-Host with the -background color to White, -noNewLine, and the -foreground color to be the appropriate index. This leverages the fact that odd ASCII values are Red, while even ASCII values are Blue via $_%2 as the index.

Console colors in PowerShell are very limited, so this is the closest approximation I could get. It would be golfier to use 4 (DarkRed) for the red, but it doesn't look right, so I'm sacrificing a couple bytes for the sake of color accuracy.

Below is the output, followed by the 16 available colors the console can display. Note that the background isn't truly white, since Microsoft in their wisdom opted to have the background colors ever-so-slightly-off from the foreground colors.

Console Output

share|improve this answer
    
IIRC, in ancient stuff, you had 4 bits for the foreground and 3 bits for the background, so backgrounds could only be the 'dark' colors 0-7. Is the console still following that? – Hurkyl 2 days ago
    
@Hurkyl Kinda. It appears to be based on the EGA color palette, but I'm not sure the historical reasons for PowerShell keeping that scheme. Likely something buried in the Win32 API backwards-compatibility that forced them to only use those 16 colors. – TimmyD 2 days ago
    
It doesn't work if you set the background color to 15? – Random832 yesterday
    
@Random832 it is for the sake of the white background of the sticker. – geisterfurz007 yesterday
    
@geisterfurz007, TimmyD, I was asking if you could set the background to "15" rather than "white" [since the actual background in your image appears to be #7] to get a brighter white. But on looking at it more, your whole display looks strange - the borders between the lines in your example and the gray line between "I" and the following space don't make sense if PowerShell is being run in the console - are you using some other tool like ConEmu? If so it doesn't make sense to blame Microsoft for this. – Random832 yesterday

Java, 322 319 318 309 304 229 bytes

-9 Bytes thanks to kevin.
-75 Bytes thanks to Angzuril, nice callout on the old awt classes, always forget those exist.

import java.awt.*;
void n(){Frame j=new Frame();j.add(new Container(){public void paint(Graphics g){int i=0;for(String c:"IVoted".split("")){g.setColor(i%2<1?Color.RED:Color.BLUE);g.drawString(c,i++*8,10);}}});j.setVisible(0<1);}

Output:

enter image description here

share|improve this answer
1  
JFrame j= can be golfed to Frame j=; (c==' '||i++%2==0)? can be golfed to c<33|i++%2<1? and true can be golfed to 1>0. Also, @HelkaHomba, is this a valid output? Since it also has spaces between the V o t e d? Oh, and why 0,0,999,99? 0,0,99,99 is large enough for the text on my screen. – Kevin Cruijssen 2 days ago
    
@KevinCruijssen 99 covers the text, but not the min size of the panel. Also, it doesn't have spaces; if you change the font to something where the characters are guaranteed to be the same width, it'd look better. – carusocomputing 2 days ago
1  
(c<33||i++%2<1)? can stil be golfed by three bytes by removing the parenthesis and change || to | – Kevin Cruijssen 2 days ago
1  
I found some more things to golf: new JComponent to new Container (-1); remove char c="IVoted".charAt(i); and change g.drawString(c+"" to g.drawString("IVoted".charAt(i)+""(-8). – Kevin Cruijssen yesterday
1  
First improvement, change Frame j=new JFrame();j.add(new JComponent() to Frame j=new Frame();j.add(new Container() and you can also drop the import import javax.swing.*; and g.setColor(Color.WHITE);g.fillRect(0,0,99,99) as a result (-63) – Angzuril 13 hours ago

ImageMagick, 105 bytes

magick xc:[x60] -fill red -draw 'text 5,30 "I     o  e"' -fill blue -draw 'text 15,30 "V   t   d"' show:

Ungolfed:

magick xc:[x60] -fill red -draw 'text 5,30 "I     o  e"' \
-fill blue -draw 'text 15,30 "V   t   d"' show:

enter image description here

This assumes that ImageMagick's default background is white; if not, add 5 bytes so the input file is xc:white instead of just xc:.

If you are so inclined after the election, add 12 bytes -rotate 180 preceding the show: directive:

enter image description here

share|improve this answer

Jolf, 53 bytes

"<z>I <w>V<z>o<w>t<z>e<w>d<style>w{ΞΩ4blue}z{ΞΩ4red

There are unprintables. Try it here!

Jolf's output is HTML capable. I tried doing something clever like modulus 2 to decide color, but that only wound up longer (around 69 bytes). So, the output is in HTML.

Output:

regular "I Voted"

(larger version)

large "I Voted"

share|improve this answer
8  
This is terrible you've only saved three bytes over HTML :P – ASCII-only 2 days ago
    
@EriktheGolfer It really only works in firefox. – Conor O'Brien 2 days ago
    
@ConorO'Brien Oh, I use Chrome. Thanks. – Erik the Golfer 2 days ago
1  
...aand the HTML answer outgolfed this. – betseg 2 days ago
    
Can't blue be written as 00f? – Ismael Miguel 11 hours ago

Python, 91 bytes + termcolor

Not gonna win, but posted it for fun.

from termcolor import*
for c in'I Voted':cprint(c,'brleude'[ord(c)%2::2],'on_white',end='')

Half the credit goes to Sp3000.

share|improve this answer
2  
Using ANSI codes should be shorter – TùxCräftîñg 2 days ago
    
@TùxCräftîñg It isn't supported on all platforms, i.e. Windows. – Shebang 2 days ago
3  
Mind adding an image? – Calvin's Hobbies 2 days ago
7  
You can save 5 bytes by changing 'blue' if c else 'red' to 'brleude'[c^1::2]. – Shebang 2 days ago
1  
You should probably put + termcolor in the title since it's not a standard module. Also: from termcolor import*\nfor c in'I Voted':cprint(c,'brleude'[ord(c)%2::2],'on_white',end='') – Sp3000 2 days ago

Bash, 35 bytes

My script looks like this

echo "^[[47;31mI hope^[[34md^H^H^Ht^H^H^Hv"

xxd of script file:

0000000: 6563 686f 2022 1b5b 3437 3b33 316d 4920  echo ".[47;31mI 
0000010: 686f 7065 1b5b 3334 6d64 0808 0874 0808  hope.[34md...t..
0000020: 0876 22                                  .v"

Typing it: ctrl-v-esc and ctrl-v-h will insert the escapes and backspaces (^[ and ^H).

enter image description here

share|improve this answer
    
How does this work? An explanation would be super – cat yesterday
    
@cat it appears to write all the red letters (with "h" and "p" as stand-ins), then sets the colour to blue and writes "d" at the end. Finally it moves the cursor left to add the "t" and "V" over the earlier stand-ins (ascii 0x08, represented by "^H" in the display above, moves left 1 character). Clever way of avoiding lots of escape sequences for colour changes. It also uses a literal escape character (0x1B, represented as "^[") which saves some space compared to similar answers like mine. – Dave yesterday
    
Also: could save 3 bytes by assuming the terminal is set to a white background by default (most other terminal answers already assume this). – Dave yesterday
    
You can save a byte by removing the two quotes and adding a backslash (escape character) before the semicolon. Also your script has a lower case v (your command line one is fine). – paxdiablo 1 hour ago

Python, 99 87 bytes

from turtle import*
up()
for c in"I Voted":color("brleude"[ord(c)%2::2]);write(c);fd(7)

Try it online

share|improve this answer
    
Mind adding an image? – Calvin's Hobbies 2 days ago
    
@HelkaHomba All you need to do it click the link. – mbomb007 2 days ago

sh, 61 49 bytes

echo "[47;31;1mI [34mV[31mo[34mt[31me[34md"

Because this contains unprintables, here is a reversible xxd hexdump:

00000000: 6563 686f 2022 1b5b 3437 3b33 313b 316d  echo ".[47;31;1m
00000010: 4920 1b5b 3334 6d56 1b5b 3331 6d6f 1b5b  I .[34mV.[31mo.[
00000020: 3334 6d74 1b5b 3331 6d65 1b5b 3334 6d64  34mt.[31me.[34md
00000030: 22                                       "
I Voted
Xterm(322)

Thanks to 4198 (manatwork) for -12 bytes.

share|improve this answer
    
Why setting the background and foreground colors separately? Start it with [47;31;1m. And the 1 for bold persists until a 0, so no need to set it again and again for each letter. – manatwork 2 days ago
    
@manatwork Oh god, I thought you have to re-set it! – Erik the Golfer 2 days ago
    
If that sh is anything more modern than the old Bourne shell, some parameter expansion may help: s=":1;47;1mI :4mV:1mo:4mt:1me:4md";echo ${s//:/^[[3}. – manatwork 2 days ago
    
@manatwork It does not work. It seems it's not more modern. – Erik the Golfer 2 days ago
    
@manatwork ${VAR/FROM/TO} requires ksh93, bash or zsh, not just “anything more modern than the old Bourne shell”. POSIX requires the # and % parameter expansion modifiers but not /…/ or :…: – Gilles 2 days ago

REBOL, 100 90 95 bytes (-7 bytes with REPL for 88)

REBOL[]view layout[style b tt blue white space 0 across b"I"red b b"V"b"o"red b"t"b"e"red b"d"]

In REPL, the initial REBOL[] is not required. That's 7 bytes.

The ungolfed version is:

REBOL[]
view layout[
  ; by default, tt (text) has a grey background and a 2x2 padding
  style b tt blue white space 0
  ; this one doesn't appear in the golfed version as it's slightly shorter to just manually set red everywhere needed
  style r b red

  ; by default, vertical stack panel
  across
  r "I"
  r 
  b "V"
  r "o"
  b "t"
  r "e"
  b "d"
]

On the left, with "space 0x0" added to each text block, on the right, with the default 2x2 padding.

REBOL I Voted

share|improve this answer
    
REPL-only code is generally not allowed, sorry – cat 2 days ago

Processing, 83 85 83 bytes

Had to increase byte count to include spaces to avoid overlapping letters

Then I reduced byte count by changing the positions and removing spaces

Processing is basically Java, but more artistic and less verbose (emphasis on less verbose).

background(255);fill(#ff0000);text("I   o e",2,9);fill(#0000ff);text("V  t d",9,9);

Explanation:

background(255); //sets background colour to white
fill(#ff0000); //setting the text colour to red
text("I   o e",2,9); //Display text "I   o e" (in red) at position (2,9) [Origin is top left]
fill(#0000ff); //set the text colour to blue
text("V  t d"); //Display text "  V  t d" (in blue) at position (9,9)

enter image description here

share|improve this answer
    
@sanchises I don't know how to fix it yet – Kritixi Lithos 2 days ago
    
@sanchises I tried it, but that just messes things up even more so – Kritixi Lithos 2 days ago
    
@sanchises Done! – Kritixi Lithos 2 days ago
    
Could you try tabs (\t) instead to try and save bytes? – Artyer 2 days ago
    
@Artyer The tabs don't help, I've tried. – Kritixi Lithos 2 days ago

Bubblegum, 28 bytes

0000000: 938e 3636 ccf5 0492 e6b9 0a40 d224 370c  ..66.......@.$7.
0000010: 2c92 0f66 9780 d9a9 6076 0a00            ,..f....`v..

enter image description here

Does not work online since it uses ANSI color codes for coloring.

share|improve this answer
    
Is this a straight-up encoding, or is does it employ some other clever trick? – Conor O'Brien 2 days ago
1  
@ConorO'Brien There is no such thing as clever tricks in Bubblegum. To be honest, this answer was mostly a side-effect of the actual answer I'm working on. – quartata 2 days ago

SVG + bzip2, 1807 bytes

A vectorized version of the example image, then compressed with bzip2 to about half (4385 -> 1807 bytes). You can download it here. (direct GitHub Pages link)

BZh91AY&SY!�l�ß�x��>�ߠ/���`    0����Ҁ�D�5��ޠII�T񡤙�O!45J??��i�@JzH���
.�M�&�Q�vا����bB���� �쾾�4AV�8�8���)Z�ޣ�j�q}�����?�t�/
�±%��"A����B�X�(␌�[⎺;Z/┐├*��%�␤�       I���Uƒ�Y�9ǝK���B��┤�=���±?�W���
            ��ڰj�?�H��\����^��m�=X�d���>�!C�@�.���9�" DZ+��V1+�;�����58Q���-:�5,HDQŧ`A>����W�+h��>m��G�m�uWv�&�U�|mq�u���?=S�\{(��Z�a�I��G{Cd��;Bz���qX7��?P�@�Jt[w�]����%W���37f���-񴁭�iԳ]c��|�;i�k�H��
    sHz��Y�$�.�*�?�ڐ��Us=\뫅6%�Ud�9w���D
                                          ��H��^�Q��P��%n�O����l��+*q�U�"F%��*�     *b�� 
                                         @mP���Z�(ZL`
  bIv⦳�~�F=��>H�Ti����0@≠R≥��T�E��┴��D����␍│��2*◆=└6&⎽M�◆␊?�/�U�����r�.�`gƅ���E'��^��ILPz@���zR&u$��l^�U�n�'O\�Xj+چ�o�*�O�w��JP8���]���r��k=��N�b�ƵpM�8|���=7���N��W�M(����*�E�DݐT��Zi�v"���49�J�0}�F�*x�K���P��⎼*�������6[G,4� ү)UUT␍��%4D��Թ␉��⎻�8�CZ_3ɷwW�9��-&�Ov�a՜
�'ӥtߢ�>��^�m-������c�]:��*��2��촄Ujr�?"�J�"���DE�f?┴⎻��␍3·└���Ԉ��? ׌�5|ᫎ���|DO���%�4Ư`W�ƐV/=�]V`gˇ��^Z��cP������.{������6   o.*�sɽ���U?E.3�,�H$�{�?
             �%�0��2    ��n�C!%�>��]��
#߽v�E��K��?X|���5�ΰ@>A;#J���,��Q��$���ݨ��^����7�g�Xn�k����d욒�`fQ/7��vh|�ȥ*^M
                            �[����׈���i�I��    $��4��
  Y��`V.��ح��?�eT����5K˱~�瞯r�fL^I �#b�@�pBƞ���V`5��a��qH���Ş�t�V3��┌���T���1␉�␍$5��@T␤$�>$����π���S�[۸£�[ȟ␋CO≥�ގ^��>��]E�A��┘���I(�㴨Z�J'��:�-_┤±�K␌�ۓ#:�?m��^�Z�+�����G
�k�t�O��SD�4����^o��Z�n���6M�)!��r��w�3\�R����
�X6<#����.��p� Cj"�2�ĭ�*h�S�`}�L���C?�� �چZc'kG��

Not gonna win, but posted it for fun.

share|improve this answer
    
bzip2 is not a programming language. – Peter Taylor 2 days ago
2  
@PeterTaylor Per meta rules, it doesn't have to be a programming language. (meta.codegolf.stackexchange.com/a/10426/41088 – CrazyPython 2 days ago
    
should post a reversible xxd of the file – cat 2 days ago
    
try using brotli for even more compression – Sarge Borsch yesterday
1  
If you're really interested in golfing this, it would probably make more sense to just create the SVG by hand with a couple text elements set to the right colors. Here's a starting point: <svg xmlns="http://www.w3.org/2000/svg"><text fill="blue"><tspan fill="red">I</tspan> V<tspan fill="red">o</tspan>t<tspan fill="red">e</tspan>d</text></svg> Note that this actually renders it outside the printable area and has no background color. Like I said, it's just a start. – trlkly yesterday

Xamarin.Forms C#, 317 bytes

using Xamarin.Forms;public class App:Application{public App(){var s=new StackLayout{BackgroundColor=Color.White,Orientation=(StackOrientation)1,VerticalOptions=LayoutOptions.End};foreach(var c in"I Voted")s.Children.Add(new Label{Text=c+"",TextColor=c%2<1?Color.Blue:Color.Red});MainPage=new ContentPage{Content=s};}}

VerticalOptions=LayoutOptions.End is needed for iOS, otherwise the text will be overlayed by status bar. No problem on Android so can save 34 bytes including comma.

Ungolfed

using Xamarin.Forms;
public class App : Application
{
    public App()
    {
        // Make a horizontal StackLayout for labels
        var s = new StackLayout
        {
            BackgroundColor = Color.White,
            Orientation = (StackOrientation)1,   // StackOrientation.Horizontal
            VerticalOptions = LayoutOptions.End
        };
        foreach(var c in "I Voted")
            // Make a new label for each letter, then add to StackLayout
            s.Children.Add(new Label
                {
                    // Cast char to string
                    Text = c + "",
                    // Happens that 'I', 'o', and 'e' are all odd in ASCII, and 'V', 't', and 'd' are all even :)
                    TextColor = c%2<1 ? Color.Blue : Color.Red   
                }
            );
        // Set app MainPage to be a new ContentPage, where the content is the StackLayout above
        MainPage = new ContentPage { Content = s };
    }
}
share|improve this answer
1  
Well that's a new kind of idea. +1 – mojimonster yesterday

Bash, 61 bytes

b="\e[34m";r=${b/4/1};echo -e ${r}I ${b}V${r}o${b}t${r}e${b}d

enter image description here

with white background 61 + 9 byte:

b="\e[34m";r=${b/4/1};echo -e "\e[107m"${r}I ${b}V${r}o${b}t${r}e${b}d
share|improve this answer
    
Could you set the background to white, please? – Paŭlo Ebermann 2 days ago
    
@PaŭloEbermann , done – Babyy 2 days ago
    
oddly, in my terminal program (ROXTerm), the first one is on a white background, while the second one has a slightly light grey background. – trlkly yesterday
    
@trlkly the first one doesn't set any background, so it will show with the default background. (Which would be a light green for me, and seemingly a white for you.) The second one selects the "white" background from the palette, which looks white here, but can be configured in most terminals. – Paŭlo Ebermann yesterday

C, 65 bytes

i;main(c){for(;c="I Voted"[i++];printf("\33[3%dm%c",c&1?1:4,c));}

or, more accurately:

i;main(c){for(i=90;c="\0.noitcele ym saw ti fi enod evah dluow I sseug I tuB .hsitirB ma I esuaceb ,etov ton did I"[i--];printf("\33[3%dm%c",c&1?1:4,c));}

Uses the same bash colour technique used by betseg, but with the octal escape sequence instead of hex, and with Sp3000's observation that all odd codepoints are red.

Leaves the terminal in blue. Reset with:

printf "\33[0m";
share|improve this answer
    
If || works in C like it does in JavaScript (x||y -> x?x:y), you could do c&1||4 to save a byte. – ETHproductions 2 days ago
1  
@ETHproductions doesn't work that way in C. While || and && are short-circuiting, they always return 1 or 0, regardless of the values involved. – Dave 2 days ago
    
@Dave I learned something today... – cat 2 days ago
    
This doesn't set the background color. Also, you could use a literal escape character instead of \33 to save two bytes, if that isn't against the rules somehow. – user61954 23 hours ago
    
@yellowantphil this assumes the default terminal background is set to white (since the challenge says it just needs to be possible to have it on a white background). In fact in OS X, the terminal is black-on-white out-of-the-box. – Dave 22 hours ago

Emmet, 49 62 61 68 bytes

a{I}+r{V}+a{o}+r{t}+a{e}+r{d}+style{r{color:red}}
r{I&nbsp;}+w{V}+r{o}+w{t}+r{e}+w{d}+style{r{color:red}w{color:#00f}}

Running this will generate the following HTML code:

<w>I</w> <r>V</r> <w>o</w> <r>t</r> <w>e</w> <r>d</r> <style>r{color:red}w{color:00f}</style>

And it looks like this:
1

It's using the blue of links, so the only color that needs to be set is red, saving us some bytes.

share|improve this answer
    
That's a cool approach. Unfortunately, I don't think it counts. The OP specified that is not allowed – DrMcMoylex 2 days ago
    
I managed to miss that, removed links and added 13 bytes. – DecentM 2 days ago
    
OK, thanks. BTW, welcome to the site! – DrMcMoylex 2 days ago
    
I like the answer, and I would let it slide, but you may want to add a space between the I and V. you can also change 'blue' to 0ffto save a byte! – tuskiomi 2 days ago
    
I did have a space in there at first, but Emmet adds a newline after every element. Because of this, adding a space would not increase the distance between the two letters. – DecentM 2 days ago

Perl, 57 + 17 = 74 bytes

Run with -MTerm::ANSIColor

sub c{color$a++%2?blue:red}say c,"I ",c,V,c,o,c,t,c,e,c,d

Your terminal may be blue at the end (append ,c("reset") at the end of the code to restore it to normal).

By default, terminals are usually black background, but they can be optionally changed to white, which I personally don't think is cheating.

With picture: enter image description here

share|improve this answer
    
@HelkaHomba I added a picture! – Gabriel Benamy 2 days ago

PHP, 199 201 150 bytes

This script outputs image to standard output. Updated thanks to manatwork

imagefill($i=imagecreatetruecolor(99,99),0,0,~2**24);foreach([I,' ',V,o,t,e,d]as$k=>$e)imagestring($i,2,$k*9,0,$e,!$k|$k&1?0xFF0000:255);imagepng($i);

Run it in the command line like this:

php -d error_reporting=0 -r "imagefill($i=imagecreatetruecolor(99,99),0,0,~2**24);foreach([I,' ',V,o,t,e,d]as$k=>$e)imagestring($i,2,$k*9,0,$e,!$k|$k&1?0xFF0000:255);imagepng($i);" > output.png

Output:

enter image description here

share|improve this answer
1  
Skip the header() call. Your code works fine run from command line too. As error_reporting's default value not shows notices, is generally acceptable to not quote your string literals. Or if you not like that, str_split("I Voted") is still shorter than enumerating the characters separately. And move the assignment to $i to its first usage. – manatwork yesterday
    
~2**24 seems to work instead of 0xFFFFFF. Not sure if this is valid for all architectures. If not, 2**24-1 should be portable. – manatwork yesterday
    
@manatwork awesome thanks. That got it down to 152. I tried ~2**24 and 2**24-1 but I got errors. I don't even know how those work. – Kodos Johnson yesterday
    
Probably your PHP is older than 5.6.0: “Added an exponentiation operator (**).” – PHP changelog. Same as pow(), but handier for golfing. pastebin.com/jFn6ahFk – manatwork yesterday
    
Oh I see. Well since php 5.5 seems to be unsupported, I'll use your solution. Now it's 150. Thanks again. – Kodos Johnson yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.