Difference between revisions of "Physical colour numbers"

From BeebWiki
Jump to: navigation, search
(Draft page.)
 
m (Tidied formatting.)
Line 1: Line 1:
  7  6  5  4  3  2  1  0
+
[[Category:VDU commands]]
+---+---+---+---+---+---+---+---+
+
|F/B| B |  |  |  | B | G | R |
+
  7  6  5  4  3  2  1  0
+---+---+---+---+---+---+---+---+
+
+---+---+---+---+---+---+---+---+
  |  |  |  |  |  |  |  |
+
|F/B| B |  |  |  | B | G | R |
  |  |  |  |  |  |  |  +---Red
+
+---+---+---+---+---+---+---+---+
  |  |  |  |  |  |  +-------Green
+
  |  |  |  |  |  |  |  |
  |  |  |  |  |  +-----------Blue
+
  |  |  |  |  |  |  |  +---Red
  |  |  +---+---+---------------Extension
+
  |  |  |  |  |  |  +-------Green
  |  +---------------------------Border
+
  |  |  |  |  |  +-----------Blue
  +-------------------------------0=Foreground, 1=Background
+
  |  |  +---+---+---------------Extension
 
+
  |  +---------------------------Border
 
+
  +-------------------------------0=Foreground, 1=Background
  0 0 x x x b g r - foreground colour
+
  0 1 x x x b g r -
+
  1 0 x x x b g r - background colour
+
  0 0 x x x b g r - foreground colour
  1 1 x x x b g r - border colour
+
  0 1 x x x b g r -
 
+
  1 0 x x x b g r - background colour
BBC implements:
+
  1 1 x x x b g r - border colour
  l x x x f b g r - foreground colour
+
          +-------- flash
+
BBC implements:
 
+
  l x x x f b g r - foreground colour
Spectrum implements:
+
          +-------- flash
  l b x f i b g r - foreground colour
+
    |  | +-------- bright
+
Spectrum implements:
    |  +---------- flash
+
  l b x f i b g r - foreground colour
    +-------------- border
+
    |  | +-------- bright
 
+
    |  +---------- flash
    Bit 0 - Red
+
    +-------------- border
    Bit 1 - Green
+
    Bit 2 - Blue
+
      Bit 0 - Red
    Bit 3 - Bright
+
      Bit 1 - Green
    Bit 4 - Flash
+
      Bit 2 - Blue
    Bit 5 - Change colour only, don't change Flash and Bright
+
      Bit 3 - Bright
    Bit 6 - Change Flash and Bright only, don't change colours
+
      Bit 4 - Flash
    Bit 7 - 0=Set foreground or flash/bright, 1=Set background or border
+
      Bit 5 - Change colour only, don't change Flash and Bright
 
+
      Bit 6 - Change Flash and Bright only, don't change colours
  This results in the colour being set as follows:
+
      Bit 7 - 0=Set foreground or flash/bright, 1=Set background or border
 
+
    &00+n (0-63)    - text foreground colour
+
    This results in the colour being set as follows:
    &40+n (64-127)  - flash and bright without changing colours
+
    &80+n (128-191) - text background colour
+
      &00+n (0-63)    - text foreground colour
    &C0+n (192-255) - border colour
+
      &40+n (64-127)  - flash and bright without changing colours
 
+
      &80+n (128-191) - text background colour
      Fore    Back
+
      &C0+n (192-255) - border colour
      ground  ground    Border    Colour
+
      0 &00  128 &80  192 &C0  Black
+
        Fore    Back
      1 &01  129 &81  193 &C1  Red
+
      ground  ground    Border    Colour
      2 &02  130 &82  194 &C2  Green
+
      0 &00  128 &80  192 &C0  Black
      3 &03  131 &83  195 &C3  Yellow
+
      1 &01  129 &81  193 &C1  Red
      4 &04  132 &84  196 &C4  Blue
+
      2 &02  130 &82  194 &C2  Green
      5 &05  133 &85  197 &C5  Magenta
+
      3 &03  131 &83  195 &C3  Yellow
      6 &06  134 &86  198 &C6  Cyan
+
      4 &04  132 &84  196 &C4  Blue
      7 &07  135 &87  199 &C7  White
+
      5 &05  133 &85  197 &C5  Magenta
 
+
      6 &06  134 &86  198 &C6  Cyan
Spectrum Colour Numbers with BBC BASIC support
+
      7 &07  135 &87  199 &C7  White
----------------------------------------------
+
 
+
Spectrum Colour Numbers with BBC BASIC support
b0: Red
+
----------------------------------------------
b1: Green
+
b2: Blue
+
b0: Red
b3: Intense
+
b1: Green
b4: Flash
+
b2: Blue
b5: 0=change F/I        1=don't change F/I
+
b3: Intense
b6: 0=change RGB        1=don't change RGB
+
b4: Flash
b7: 0=foreground or F/I  1=background or border
+
b5: 0=change F/I        1=don't change F/I
 
+
b6: 0=change RGB        1=don't change RGB
 
+
b7: 0=foreground or F/I  1=background or border
  0  &00  %000FIBGR - foreground colour
+
32  &20  %001xxBGR - foreground colour, don't change current F and I
+
64  &40  %010FIxxx - set F and I without changing current colours
+
  0  &00  %000FIBGR - foreground colour
96  &60  %011xxxxx - don't change anything!
+
  32  &20  %001xxBGR - foreground colour, don't change current F and I
128  &80  %100FIBGR - background colour
+
  64  &40  %010FIxxx - set F and I without changing current colours
160  &A0  %101xxBGR - background colour, don't change current F and I
+
  96  &60  %011xxxxx - don't change anything!
192  &C0  %110xxBGR - border colour (no F or I anyway)
+
128  &80  %100FIBGR - background colour
224  &E0  %111xxBGR - border colour, don't change current F and I
+
160  &A0  %101xxBGR - background colour, don't change current F and I
 
+
192  &C0  %110xxBGR - border colour (no F or I anyway)
 
+
224  &E0  %111xxBGR - border colour, don't change current F and I
%000IFBGR - foreground colour
+
-----------------------------
+
  0 black ink
+
%000IFBGR - foreground colour
  1 red ink
+
-----------------------------
  2 green ink
+
  0 black ink
  3 yellow ink
+
  1 red ink
  4 blue ink
+
  2 green ink
  5 magenta ink
+
  3 yellow ink
  6 cyan ink
+
  4 blue ink
  7 white ink
+
  5 magenta ink
 
+
  6 cyan ink
  8 black ink, bright
+
  7 white ink
  9 red ink, bright
+
10 green ink, bright
+
  8 black ink, bright
11 yellow ink, bright
+
  9 red ink, bright
12 blue ink, bright
+
  10 green ink, bright
13 magenta ink, bright
+
  11 yellow ink, bright
14 cyan ink, bright
+
  12 blue ink, bright
15 white ink, bright
+
  13 magenta ink, bright
 
+
  14 cyan ink, bright
16 black ink, flash
+
  15 white ink, bright
17 red ink, flash
+
18 green ink, flash
+
  16 black ink, flash
19 yellow ink, flash
+
  17 red ink, flash
20 blue ink, flash
+
  18 green ink, flash
21 magenta ink, flash
+
  19 yellow ink, flash
22 cyan ink, flash
+
  20 blue ink, flash
23 white ink, flash
+
  21 magenta ink, flash
 
+
  22 cyan ink, flash
24 black ink, bright, flash
+
  23 white ink, flash
25 red ink, bright, flash
+
26 green ink, bright, flash
+
  24 black ink, bright, flash
27 yellow ink, bright, flash
+
  25 red ink, bright, flash
28 blue ink, bright, flash
+
  26 green ink, bright, flash
29 magenta ink, bright, flash
+
  27 yellow ink, bright, flash
30 cyan ink, bright, flash
+
  28 blue ink, bright, flash
31 white ink, bright, flash
+
  29 magenta ink, bright, flash
 
+
  30 cyan ink, bright, flash
%001xxBGR - foreground colour, don't change current F and I
+
  31 white ink, bright, flash
-----------------------------------------------------------
+
32 black ink, bright unchanged, flash unchanged
+
%001xxBGR - foreground colour, don't change current F and I
33 red ink, bright unchanged, flash unchanged
+
-----------------------------------------------------------
34 green ink, bright unchanged, flash unchanged
+
  32 black ink, bright unchanged, flash unchanged
35 yellow ink, bright unchanged, flash unchanged
+
  33 red ink, bright unchanged, flash unchanged
36 blue ink, bright unchanged, flash unchanged
+
  34 green ink, bright unchanged, flash unchanged
37 magenta ink, bright unchanged, flash unchanged
+
  35 yellow ink, bright unchanged, flash unchanged
38 cyan ink, bright unchanged, flash unchanged
+
  36 blue ink, bright unchanged, flash unchanged
39 white ink, bright unchanged, flash unchanged
+
  37 magenta ink, bright unchanged, flash unchanged
 
+
  38 cyan ink, bright unchanged, flash unchanged
%010FIxxx - set I and F without changing current colours
+
  39 white ink, bright unchanged, flash unchanged
--------------------------------------------------------
+
64 flash off, bright off
+
%010FIxxx - set I and F without changing current colours
72 flash off, bright on
+
--------------------------------------------------------
80 flash on, bright off
+
  64 flash off, bright off
88 flash on, bright on
+
  72 flash off, bright on
 
+
  80 flash on, bright off
%011xxxxx - reserved - don't change current F/I or RGB
+
  88 flash on, bright on
-----------------------------------------------------
+
 
+
%011xxxxx - reserved - don't change current F/I or RGB
%100IFBGR - background colour
+
-----------------------------------------------------
-----------------------------
+
128 black paper
+
%100IFBGR - background colour
129 red paper
+
-----------------------------
130 green paper
+
128 black paper
131 yellow paper
+
129 red paper
132 blue paper
+
130 green paper
133 magenta paper
+
131 yellow paper
134 cyan paper
+
132 blue paper
135 white paper
+
133 magenta paper
 
+
134 cyan paper
136 black paper, bright
+
135 white paper
137 red paper, bright
+
138 green paper, bright
+
136 black paper, bright
139 yellow paper, bright
+
137 red paper, bright
140 blue paper, bright
+
138 green paper, bright
141 magenta paper, bright
+
139 yellow paper, bright
142 cyan paper, bright
+
140 blue paper, bright
143 white paper, bright
+
141 magenta paper, bright
 
+
142 cyan paper, bright
144 black paper, flash
+
143 white paper, bright
145 red paper, flash
+
146 green paper, flash
+
144 black paper, flash
147 yellow paper, flash
+
145 red paper, flash
148 blue paper, flash
+
146 green paper, flash
149 magenta paper, flash
+
147 yellow paper, flash
150 cyan paper, flash
+
148 blue paper, flash
151 white paper, flash
+
149 magenta paper, flash
 
+
150 cyan paper, flash
152 black paper, bright, flash
+
151 white paper, flash
153 red paper, bright, flash
+
154 green paper, bright, flash
+
152 black paper, bright, flash
155 yellow paper, bright, flash
+
153 red paper, bright, flash
156 blue paper, bright, flash
+
154 green paper, bright, flash
157 magenta paper, bright, flash
+
155 yellow paper, bright, flash
158 cyan paper, bright, flash
+
156 blue paper, bright, flash
159 white paper, bright, flash
+
157 magenta paper, bright, flash
 
+
158 cyan paper, bright, flash
%101xxBGR - foreground colour, don't change current F and I
+
159 white paper, bright, flash
-----------------------------------------------------------
+
160 black paper, bright unchanged, flash unchanged
+
%101xxBGR - foreground colour, don't change current F and I
161 red paper, bright unchanged, flash unchanged
+
-----------------------------------------------------------
162 green paper, bright unchanged, flash unchanged
+
160 black paper, bright unchanged, flash unchanged
163 yellow paper, bright unchanged, flash unchanged
+
161 red paper, bright unchanged, flash unchanged
164 blue paper, bright unchanged, flash unchanged
+
162 green paper, bright unchanged, flash unchanged
165 magenta paper, bright unchanged, flash unchanged
+
163 yellow paper, bright unchanged, flash unchanged
166 cyan paper, bright unchanged, flash unchanged
+
164 blue paper, bright unchanged, flash unchanged
167 white paper, bright unchanged, flash unchanged
+
165 magenta paper, bright unchanged, flash unchanged
 
+
166 cyan paper, bright unchanged, flash unchanged
%110FIxxx - border colour (but border doesn't have flash or bright)
+
167 white paper, bright unchanged, flash unchanged
-------------------------------------------------------------------
+
192 black border
+
%110FIxxx - border colour (but border doesn't have flash or bright)
193 red border
+
-------------------------------------------------------------------
194 green border
+
192 black border
195 yellow border
+
193 red border
196 blue border
+
194 green border
197 magenta border
+
195 yellow border
198 cyan border
+
196 blue border
199 white border
+
197 magenta border
 
+
198 cyan border
%111xxBGR - reserved - border colour, don't change current F and I
+
199 white border
------------------------------------------------------------------
+
 
+
%111xxBGR - reserved - border colour, don't change current F and I
 
+
------------------------------------------------------------------
 
+
Commodore implements
+
  l b x f i b g r - foreground colour
+
    |  | +-------- bright
+
Commodore implements
    |  +---------- flash
+
  l b x f i b g r - foreground colour
    +-------------- border
+
    |  | +-------- bright
 
+
    |  +---------- flash
  %00xxxbgr - &00+num - foreground colour
+
    +-------------- border
  %01xxxbgr - &40+num - reserved
+
  %10xxxbgr - &80+num - background colour
+
  %00xxxbgr - &00+num - foreground colour
  %11xxxbgr - &C0+num - border colour
+
  %01xxxbgr - &40+num - reserved
 
+
  %10xxxbgr - &80+num - background colour
The Commodore 64 has 16 physical colours, so this gives the following
+
  %11xxxbgr - &C0+num - border colour
colours:
+
 
+
The Commodore 64 has 16 physical colours, so this gives the following
      Fore    Back
+
colours:
    ground  ground    Border    Colour
+
      0 &00  128 &80  192 &C0  Black
+
      Fore    Back
      1 &01  129 &81  193 &C1  Red
+
      ground  ground    Border    Colour
      2 &02  130 &82  194 &C2  Green
+
      0 &00  128 &80  192 &C0  Black
      3 &03  131 &83  195 &C3  Yellow
+
      1 &01  129 &81  193 &C1  Red
      4 &04  132 &84  196 &C4  Blue
+
      2 &02  130 &82  194 &C2  Green
      5 &05  133 &85  197 &C5  Magenta
+
      3 &03  131 &83  195 &C3  Yellow
      6 &06  134 &86  198 &C6  Cyan
+
      4 &04  132 &84  196 &C4  Blue
      7 &07  135 &87  199 &C7  White
+
      5 &05  133 &85  197 &C5  Magenta
      8 &08  135 &88  200 &C8  Orange
+
      6 &06  134 &86  198 &C6  Cyan
      9 &09  136 &89  201 &C9  Light Red
+
      7 &07  135 &87  199 &C7  White
    10 &0A  137 &8A  202 &CA  Light Green
+
      8 &08  135 &88  200 &C8  Orange
    11 &0B  138 &8B  203 &CB  Light Grey
+
      9 &09  136 &89  201 &C9  Light Red
    12 &0C  139 &8C  204 &CC  Light Blue
+
      10 &0A  137 &8A  202 &CA  Light Green
    13 &0D  140 &8D  205 &CD  Grey
+
      11 &0B  138 &8B  203 &CB  Light Grey
    14 &0E  141 &8E  206 &CE  Dark Grey
+
      12 &0C  139 &8C  204 &CC  Light Blue
    15 &0F  142 &8F  207 &CF  Brown
+
      13 &0D  140 &8D  205 &CD  Grey
 
+
      14 &0E  141 &8E  206 &CE  Dark Grey
 
+
      15 &0F  142 &8F  207 &CF  Brown
DOS:
+
COLOUR 0 COLOUR 128 Black
+
COLOUR 1 COLOUR 129 Red
+
DOS:
COLOUR 2 COLOUR 130 Green
+
COLOUR 0
COLOUR 3 COLOUR 131 Yellow
+
COLOUR 128
COLOUR 4 COLOUR 132 Blue
+
Black
COLOUR 5 COLOUR 133 Magenta
+
COLOUR 1
COLOUR 6 COLOUR 134 Cyan
+
COLOUR 129
COLOUR 7 COLOUR 135 White
+
Red
COLOUR 8 COLOUR 136 Intensified Black
+
COLOUR 2
COLOUR 9 COLOUR 137 Intensified Red
+
COLOUR 130
COLOUR 10 COLOUR 138 Intensified Green
+
Green
COLOUR 11 COLOUR 139 Intensified Yellow
+
COLOUR 3
COLOUR 12 COLOUR 140 Intensified Blue
+
COLOUR 131
COLOUR 13 COLOUR 141 Intensified Magenta
+
Yellow
COLOUR 14 COLOUR 142 Intensified Cyan
+
COLOUR 4
COLOUR 15 COLOUR 143 Intensified White
+
COLOUR 132
 
+
Blue
The border is specified by using -1 as the logical colour number.
+
COLOUR 5
 
+
COLOUR 133
The following example sets the border colour to green.
+
Magenta
 
+
COLOUR 6
    VDU 19,-1,2,0,0,0
+
COLOUR 134
 
+
Cyan
 
+
COLOUR 7
The alternative mode provides an 'analogue' palette by allowing you to set
+
COLOUR 135
the Red, Green and Blue intensities to any value between 0 and 63. The
+
White
format of the VGA 'analogue' colour palette command is shown below.
+
COLOUR 8
 
+
COLOUR 136
    VDU 19,logical,-1,red,green,blue
+
Intensified Black
 
+
COLOUR 9
 
+
COLOUR 137
If bit 7 of the logical colour number is set (values 128 to 143), then the
+
Intensified Red
enhanced palette is used and the physical colour is taken to be the IBM
+
COLOUR 10
colour value.
+
COLOUR 138
 
+
Intensified Green
For example, the following command will set logical colour 1 to green.
+
COLOUR 11
 
+
COLOUR 139
    VDU 19,129,2,0,0,0
+
Intensified Yellow
 
+
COLOUR 12
The text enhanced palette is the same as the graphics enhanced palette.  
+
COLOUR 140
 
+
Intensified Blue
6-bit RGB colours
+
COLOUR 13
In the 6-bit RGB mode you set the physical colour by specifying the values
+
COLOUR 141
of the individual red, green and blue components as numbers in the range 0
+
Intensified Magenta
(minimum) to 63 (maximum). Hence the value 0,0,0 corresponds to black and
+
COLOUR 14
the value 63,63,63 corresponds to peak (intensified) white.
+
COLOUR 142
 
+
Intensified Cyan
To select a logical colour to one of these physical colours you must use the
+
COLOUR 15
VDU 19 command:
+
COLOUR 143
 
+
Intensified White
    VDU 19,logical,-1,red,green,blue
+
 
+
The border is specified by using -1 as the logical colour number.
This mode is provided for compatibility with BBC BASIC (86).
+
 
+
The following example sets the border colour to green.
8-bit RGB colours
+
In the 8-bit RGB mode you set the physical colour by specifying the values
+
    VDU 19,-1,2,0,0,0
of the individual red, green and blue components as numbers in the range 0
+
(minimum) to 255 (maximum). Hence the value 0,0,0 corresponds to black and
+
the value 255,255,255 corresponds to peak (intensified) white.
+
The alternative mode provides an 'analogue' palette by allowing you to set
 
+
the Red, Green and Blue intensities to any value between 0 and 63. The
To select a logical colour to one of these physical colours you use either
+
format of the VGA 'analogue' colour palette command is shown below.
the VDU 19 command or the COLOUR statement:
+
 
+
    VDU 19,logical,-1,red,green,blue
    VDU 19,logical,16,Red,Green,Blue
+
    COLOUR logical,Red,Green,Blue
+
 
+
If bit 7 of the logical colour number is set (values 128 to 143), then the
 
+
enhanced palette is used and the physical colour is taken to be the IBM
  0 1 x x x b g r -
+
colour value.
  1 0 x x x b g r - background colour
+
  1 1 x x x b g r - border colour
+
For example, the following command will set logical colour 1 to green.
 +
 +
    VDU 19,129,2,0,0,0
 +
 +
The text enhanced palette is the same as the graphics enhanced palette.  
 +
 +
6-bit RGB colours
 +
In the 6-bit RGB mode you set the physical colour by specifying the values
 +
of the individual red, green and blue components as numbers in the range 0
 +
(minimum) to 63 (maximum). Hence the value 0,0,0 corresponds to black and
 +
the value 63,63,63 corresponds to peak (intensified) white.
 +
 +
To select a logical colour to one of these physical colours you must use the
 +
VDU 19 command:
 +
 +
    VDU 19,logical,-1,red,green,blue
 +
 +
This mode is provided for compatibility with BBC BASIC (86).
 +
 +
8-bit RGB colours
 +
In the 8-bit RGB mode you set the physical colour by specifying the values
 +
of the individual red, green and blue components as numbers in the range 0
 +
(minimum) to 255 (maximum). Hence the value 0,0,0 corresponds to black and
 +
the value 255,255,255 corresponds to peak (intensified) white.
 +
 +
To select a logical colour to one of these physical colours you use either
 +
the VDU 19 command or the COLOUR statement:
 +
 +
    VDU 19,logical,16,Red,Green,Blue
 +
    COLOUR logical,Red,Green,Blue
 +
 +
 +
  0 1 x x x b g r -
 +
  1 0 x x x b g r - background colour
 +
  1 1 x x x b g r - border colour

Revision as of 02:22, 14 January 2016


  7   6   5   4   3   2   1   0
+---+---+---+---+---+---+---+---+
|F/B| B |   |   |   | B | G | R |
+---+---+---+---+---+---+---+---+
  |   |   |   |   |   |   |   |
  |   |   |   |   |   |   |   +---Red
  |   |   |   |   |   |   +-------Green
  |   |   |   |   |   +-----------Blue
  |   |   +---+---+---------------Extension
  |   +---------------------------Border
  +-------------------------------0=Foreground, 1=Background


  0 0 x x x b g r - foreground colour
  0 1 x x x b g r -
  1 0 x x x b g r - background colour
  1 1 x x x b g r - border colour

BBC implements:
  l x x x f b g r - foreground colour
          +-------- flash

Spectrum implements:
  l b x f i b g r - foreground colour
    |   | +-------- bright
    |   +---------- flash
    +-------------- border

     Bit 0 - Red
     Bit 1 - Green
     Bit 2 - Blue
     Bit 3 - Bright
     Bit 4 - Flash
     Bit 5 - Change colour only, don't change Flash and Bright
     Bit 6 - Change Flash and Bright only, don't change colours
     Bit 7 - 0=Set foreground or flash/bright, 1=Set background or border

   This results in the colour being set as follows:

     &00+n (0-63)    - text foreground colour
     &40+n (64-127)  - flash and bright without changing colours
     &80+n (128-191) - text background colour
     &C0+n (192-255) - border colour

       Fore    Back
      ground  ground    Border    Colour
      0 &00   128 &80   192 &C0   Black
      1 &01   129 &81   193 &C1   Red
      2 &02   130 &82   194 &C2   Green
      3 &03   131 &83   195 &C3   Yellow
      4 &04   132 &84   196 &C4   Blue
      5 &05   133 &85   197 &C5   Magenta
      6 &06   134 &86   198 &C6   Cyan
      7 &07   135 &87   199 &C7   White

Spectrum Colour Numbers with BBC BASIC support
----------------------------------------------

b0: Red
b1: Green
b2: Blue
b3: Intense
b4: Flash
b5: 0=change F/I         1=don't change F/I
b6: 0=change RGB         1=don't change RGB
b7: 0=foreground or F/I  1=background or border


  0  &00  %000FIBGR - foreground colour
 32  &20  %001xxBGR - foreground colour, don't change current F and I
 64  &40  %010FIxxx - set F and I without changing current colours
 96  &60  %011xxxxx - don't change anything!
128  &80  %100FIBGR - background colour
160  &A0  %101xxBGR - background colour, don't change current F and I
192  &C0  %110xxBGR - border colour (no F or I anyway)
224  &E0  %111xxBGR - border colour, don't change current F and I


%000IFBGR - foreground colour
-----------------------------
  0 black ink
  1 red ink
  2 green ink
  3 yellow ink
  4 blue ink
  5 magenta ink
  6 cyan ink
  7 white ink

  8 black ink, bright
  9 red ink, bright
 10 green ink, bright
 11 yellow ink, bright
 12 blue ink, bright
 13 magenta ink, bright
 14 cyan ink, bright
 15 white ink, bright

 16 black ink, flash
 17 red ink, flash
 18 green ink, flash
 19 yellow ink, flash
 20 blue ink, flash
 21 magenta ink, flash
 22 cyan ink, flash
 23 white ink, flash

 24 black ink, bright, flash
 25 red ink, bright, flash
 26 green ink, bright, flash
 27 yellow ink, bright, flash
 28 blue ink, bright, flash
 29 magenta ink, bright, flash
 30 cyan ink, bright, flash
 31 white ink, bright, flash

%001xxBGR - foreground colour, don't change current F and I
-----------------------------------------------------------
 32 black ink, bright unchanged, flash unchanged
 33 red ink, bright unchanged, flash unchanged
 34 green ink, bright unchanged, flash unchanged
 35 yellow ink, bright unchanged, flash unchanged
 36 blue ink, bright unchanged, flash unchanged
 37 magenta ink, bright unchanged, flash unchanged
 38 cyan ink, bright unchanged, flash unchanged
 39 white ink, bright unchanged, flash unchanged

%010FIxxx - set I and F without changing current colours
--------------------------------------------------------
 64 flash off, bright off
 72 flash off, bright on
 80 flash on, bright off
 88 flash on, bright on

%011xxxxx - reserved - don't change current F/I or RGB
-----------------------------------------------------

%100IFBGR - background colour
-----------------------------
128 black paper
129 red paper
130 green paper
131 yellow paper
132 blue paper
133 magenta paper
134 cyan paper
135 white paper

136 black paper, bright
137 red paper, bright
138 green paper, bright
139 yellow paper, bright
140 blue paper, bright
141 magenta paper, bright
142 cyan paper, bright
143 white paper, bright

144 black paper, flash
145 red paper, flash
146 green paper, flash
147 yellow paper, flash
148 blue paper, flash
149 magenta paper, flash
150 cyan paper, flash
151 white paper, flash

152 black paper, bright, flash
153 red paper, bright, flash
154 green paper, bright, flash
155 yellow paper, bright, flash
156 blue paper, bright, flash
157 magenta paper, bright, flash
158 cyan paper, bright, flash
159 white paper, bright, flash

%101xxBGR - foreground colour, don't change current F and I
-----------------------------------------------------------
160 black paper, bright unchanged, flash unchanged
161 red paper, bright unchanged, flash unchanged
162 green paper, bright unchanged, flash unchanged
163 yellow paper, bright unchanged, flash unchanged
164 blue paper, bright unchanged, flash unchanged
165 magenta paper, bright unchanged, flash unchanged
166 cyan paper, bright unchanged, flash unchanged
167 white paper, bright unchanged, flash unchanged

%110FIxxx - border colour (but border doesn't have flash or bright)
-------------------------------------------------------------------
192 black border
193 red border
194 green border
195 yellow border
196 blue border
197 magenta border
198 cyan border
199 white border

%111xxBGR - reserved - border colour, don't change current F and I
------------------------------------------------------------------



Commodore implements
  l b x f i b g r - foreground colour
    |   | +-------- bright
    |   +---------- flash
    +-------------- border

  %00xxxbgr - &00+num - foreground colour
  %01xxxbgr - &40+num - reserved
  %10xxxbgr - &80+num - background colour
  %11xxxbgr - &C0+num - border colour

The Commodore 64 has 16 physical colours, so this gives the following
colours:

      Fore     Back
     ground   ground    Border    Colour
      0 &00   128 &80   192 &C0   Black
      1 &01   129 &81   193 &C1   Red
      2 &02   130 &82   194 &C2   Green
      3 &03   131 &83   195 &C3   Yellow
      4 &04   132 &84   196 &C4   Blue
      5 &05   133 &85   197 &C5   Magenta
      6 &06   134 &86   198 &C6   Cyan
      7 &07   135 &87   199 &C7   White
      8 &08   135 &88   200 &C8   Orange
      9 &09   136 &89   201 &C9   Light Red
     10 &0A   137 &8A   202 &CA   Light Green
     11 &0B   138 &8B   203 &CB   Light Grey
     12 &0C   139 &8C   204 &CC   Light Blue
     13 &0D   140 &8D   205 &CD   Grey
     14 &0E   141 &8E   206 &CE   Dark Grey
     15 &0F   142 &8F   207 &CF   Brown


DOS:
COLOUR 0
COLOUR 128  
Black
COLOUR 1
COLOUR 129
Red
COLOUR 2
COLOUR 130
Green
COLOUR 3
COLOUR 131
Yellow
COLOUR 4
COLOUR 132
Blue
COLOUR 5
COLOUR 133
Magenta
COLOUR 6
COLOUR 134
Cyan
COLOUR 7
COLOUR 135
White
COLOUR 8
COLOUR 136
Intensified Black
COLOUR 9
COLOUR 137
Intensified Red
COLOUR 10
COLOUR 138
Intensified Green
COLOUR 11
COLOUR 139
Intensified Yellow
COLOUR 12
COLOUR 140
Intensified Blue
COLOUR 13
COLOUR 141
Intensified Magenta
COLOUR 14
COLOUR 142
Intensified Cyan
COLOUR 15  
COLOUR 143
Intensified White

The border is specified by using -1 as the logical colour number.

The following example sets the border colour to green.

    VDU 19,-1,2,0,0,0


The alternative mode provides an 'analogue' palette by allowing you to set
the Red, Green and Blue intensities to any value between 0 and 63. The
format of the VGA 'analogue' colour palette command is shown below.

    VDU 19,logical,-1,red,green,blue


If bit 7 of the logical colour number is set (values 128 to 143), then the
enhanced palette is used and the physical colour is taken to be the IBM
colour value.

For example, the following command will set logical colour 1 to green.

    VDU 19,129,2,0,0,0

The text enhanced palette is the same as the graphics enhanced palette. 

6-bit RGB colours
In the 6-bit RGB mode you set the physical colour by specifying the values
of the individual red, green and blue components as numbers in the range 0
(minimum) to 63 (maximum). Hence the value 0,0,0 corresponds to black and
the value 63,63,63 corresponds to peak (intensified) white.

To select a logical colour to one of these physical colours you must use the
VDU 19 command:

    VDU 19,logical,-1,red,green,blue

This mode is provided for compatibility with BBC BASIC (86).

8-bit RGB colours
In the 8-bit RGB mode you set the physical colour by specifying the values
of the individual red, green and blue components as numbers in the range 0
(minimum) to 255 (maximum). Hence the value 0,0,0 corresponds to black and
the value 255,255,255 corresponds to peak (intensified) white.

To select a logical colour to one of these physical colours you use either
the VDU 19 command or the COLOUR statement:

    VDU 19,logical,16,Red,Green,Blue
    COLOUR logical,Red,Green,Blue


  0 1 x x x b g r -
  1 0 x x x b g r - background colour
  1 1 x x x b g r - border colour