The color spelling game In the color spelling game, you are shown a list of color names, but rather than reading the words that are written, you have to say the name of the color of the letters. The game is over as soon as you say the wrong color, and the player who spelled the most words correctly wins. To make the game more challeging, each word is written on a different background color.

And here is your challenge:

Write a program that creates a color spelling game.


Print every second or so the name of a color.
Use different colors for the background and the foreground.
The name of the color you print should be different than both the background and the foreground.
Do not repeat the same color name, foreground or background color in two consecutive rows. It's still ok to reuse the same color in succession for different purposes, like printing the word "red" after a word on a red background.
Choose each color (pseudo)randomly from a palette of at least 6 colors.
Use a programming language of your choice.


Here is my solution for JavaScript, change as you like: http://jsfiddle.net/xb8rqsbr/

This is a code golf challenge, so keep your code short.

Have fun!
BBC Basic, 187 176 ASCII characters, tokenised filesize 155 140
Download emulator at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html
Saved some characters: instead of using MOD to always generate random numbers that differ than the previous value, I simply generate any number and perform a check instead.
b=0f=0w=0REPEATc=b g=f x=w REPEATb=RND(6)f=RND(6)w=RND(6)UNTIL(b-f)*(f-w)*(w-b)*(b-c)*(f-g)*(w-x)VDU17,b+128,17,f:PRINTMID$(&quot;Red LimeGoldBluePinkAqua&quot;,w*4-3,4):WAIT 99UNTIL0

I used the original BBC Basic 3-bit colour codings, which are based on 1's bit=Red, 2's bit=Green, 4's bit=Blue. I renamed Yellow as Gold, Magenta as Pink and Green as Lime (justifiable given the shade produced) in order to shorten colour names. I also renamed Cyan as Aqua just because. Therefore I use colours 1 to 6 from the 3-bit scheme. I exclude 0=black and 7=white (a very light grey, as the full white belongs to the extended 16-colour set in which the 8`s bit refers to brightness.)
b=0 f=0 w=0                                     :REM initialise &quot;old&quot; values for background, foreground and word.
REPEAT                                          
  c=b g=f x=w                                   :REM c,g and x contain the old values for background, foreground and word.
  REPEAT
    b=RND(6)f=RND(6)w=RND(6)                    :REM pick random numbers between 1 and 6
  UNTIL(b-f)*(f-w)*(w-b)*(b-c)*(f-g)*(w-x)      :REM until all colours are different from each other and their previous values
  VDU17,b+128,17,f,12                           :REM VDU 17 sets colour, using the 128's bit to say if it is foreground or background. VDU 12 clears the screen.
  PRINTMID$(&quot;Red LimeGoldBluePinkAqua&quot;,w*4-3,4) :REM MID$ picks the colour. The string is considered 1-indexed.
  WAIT 99                                       :REM wait 99 centiseconds
UNTIL0

Output
The first few images show the program as written, running in screen mode 6. The bottom image shows the program with the ,12 removed so that the screen is not cleared in between word printings. That way it is easier to verify that the colours comply with the rules.