The online racing simulator
ECMA-48 & Live For Speed
Just noticed something cool in the wonderful world of LFS, Scawen is using the ECMA-48 standard for the chat colors!

LFS Code LFS Color ECMA Code ECMA Color
^0 #000000 30 black foreground
^1 #FF0000 31 red foreground
^2 #00FF00 32 green foreground
^3 #FFFF00 33 brown foreground
^4 #0000FF 34 blue foreground
^5 #FF00FF 35 magenta (purple) foreground
^6 #00FFFF 36 cyan (light blue) foreground
^7 #FFFFFF 37 gray foreground
^8 <RESET> 0 all to default
^9 <RESET> 0 all to default

You can use 4X ECMA Code to set the background color of your text in the
Linux Console and there are some other useful command codes:

0 reset all attributes to their defaults

1 set bold
2 set half-bright (simulated with color on a color display)
22 set normal intensity

4 set underscore (simulated with color on a color display)(the colors used to simulate dim or underline are set using ESC ] ...)
24 underline off

5 set blink
25 blink off

7 set reverse video
27 reverse video off

38 set underscore on, set default foreground color
39 set underscore off, set default foreground color

47 set white background
49 set default background color

They are pretty close, and you could then emulate the chat console in the linux console with InSim . Not to mention the system messages are also supported with things like blink and setting the color of the message on a rotation .
Thats cool, i never noticed that they were ECMA-48.

<?php 
php

$color 
= array('black','red','green','yellow','blue','purple','cyan','white');

function 
escCmd($cmd$msg NULL)
{
    return 
"\033[{$cmd}m" str_pad($msg10' 'STR_PAD_BOTH);
}

for (
$foreground 30$foreground 38$foreground++)
{
    for (
$background 40$background 48$background++)
        echo 
escCmd("$foreground;$background"$color[$foreground 30]);
    echo 
"\033[0m" PHP_EOL;
    for (
$background 40$background 48$background++)
        echo 
escCmd("$foreground;$background;1"$color[$foreground 30]);
    echo 
"\033[0m" PHP_EOL;
}
    echo 
escCmd("0""Done!");
?>

Oh, this is just full of awesome!

I had to install ubuntu to see this in action, so I did just that. But I did it with VMware Player. I've also added a screen shot on how this program outputs on to the linux console. Not everything is there (no blinking) but I'll implement that in my version and hand it out to you all later.
Attached images
EMCA-48 Example in Ubuntu.png
ubuntu-in-windows.png
Linux Console Colors & LFS Colors Conversion Functions

<?php 
php
function lfs2ecma($str) {
    return 
str_replace(array('^0','^1','^2','^3','^4','^5','^6','^7','^8','^9'), array("\033[30m","\033[31m","\033[32m","\033[33m","\033[34m","\033[35m","\033[36m","\033[37m","\033[0m","\033[0m"), $str) . "\033[0m";
}

function 
lfs2console($str) {
    echo 
lfs2ecma($str) . PHP_EOL;
}

lfs2console('^1(E^7AGL^4E)^8Dygear');

?>

NICE!
What is this for?
The Linux / Mac OS console.
Wow, ECMA-48 is really cool!

I like that the spec is such that you can use a loop like that to generate the colors

FGED GREDG RDFGDR GSFDG