3
The konsole adopted some ESC codes allowing to use extended
6
There is a predefined 256 color space compatible with his
7
xterm sister, and, even beyond that, a 3-byte RGB color space.
9
The ESC codes are as follows:
11
ESC[ ... 38;2;<r>;<g>;<b> ... m Select RGB foreground color
12
ESC[ ... 48;2;<r>;<g>;<b> ... m Select RGB background color
14
ESC[ ... 38;5;<i> ... m Select indexed foreground color
15
ESC[ ... 48;5;<i> ... m Select indexed background color
17
<r>,<g> and <b> are each values in the range of 0..255 and
18
represent the brightness as usual for the respective color.
20
<i> likely is a value in 0..256, but represents an indexed
21
color assignment composed as follows:
23
0 .. 15 - System color, these are taken from the schema.
24
16 .. 231 - Forms a 6x6x6 RGB color cube.
25
232 .. 255 - A gray scale ramp without black and white.
27
Try the tests/color-spaces.pl to visualize the assignment.
30
----------------------------------------------------------------
34
These ESC codes break the "associativity" of SGR, but after some
35
research the result is, that the standard itself is broken here.
37
The perhaps best codes due to ECMA-48 would probably be e.g.
38
38:2:<r>:<g>:<b>, i.e. consistently a colon instead of a semicolon.
39
But apparently, this is defined different in ISO-8613 (which is
40
included at this place in ECMA-48), actually breaking ECMA-48.
42
We cannot help this and implemented the codes as above, which
43
is a balanced decision.
45
For 256 color mode, this is compatible with xterm and perhaps
46
with other xterm compatible terminal emulations.
49
| ------- Additional Comments From awendt putergeek com 2006-06-07 07:40 -------
50
| > So a parameter substring is 0-9 and the colon. The semicolon separates
51
| > sub-parameters. Thus 48:5:<Color> would be one sub-parameter, and
52
| > 48;5;<Color> many independent, each having an independent meaning in case
53
| > of a selective parameter.
56
| I think you may be onto something here with the colons... I was able to find
57
| ITU T.416 (which is the same as ISO 8613-6) and it says:
61
| The parameter values 38 and 48 are followed by a parameter substring used to
62
| select either the character foreground ?colour value? or the character
63
| background ?colour value?.
65
| A parameter substring for values 38 or 48 may be divided by one or more
66
| separators (03/10) into parameter elements, denoted as Pe. The format of such
67
| a parameter sub-string is indicated as:
71
| Each parameter element consists of zero, one or more bit combinations from
72
| 03/00 to 03/09, representing the digits 0 to 9. An empty parameter element
73
| represents a default value for this parameter element. Empty parameter
74
| elements at the end of the parameter substring need not be included.
76
| The first parameter element indicates a choice between:
78
| 0 implementation defined (only applicable for the character
81
| 2 direct colour in RGB space;
82
| 3 direct colour in CMY space;
83
| 4 direct colour in CMYK space;
86
| If the first parameter has the value 0 or 1, there are no additional parameter
89
| If the first parameter element has the value 5, then there is a second
90
| parameter element specifying the index into the colour table given by the
91
| attribute ?content colour table? applying to the object with which the
92
| content is associated.
96
| The separator character 03/10 they use is a colon, not a semicolon... I wonder
97
| if the xterm implementation was based on an improper reading of the standard?