Difference between revisions of "Physical colour numbers"

From BeebWiki
Jump to: navigation, search
m
m (Had two 'B's !)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:VDU commands]]
 
[[Category:VDU commands]]
+
Physical colour numbers are used as the short physical colour in the VDU 19
  7  6  5  4  3  2  1  0
+
command, and used in the COLOUR and GCOL commands on platforms without a
+---+---+---+---+---+---+---+---+
+
palette. The colour number is a bitmap of the colour to select. When
|F/B| B | E | F | I | B | G | R |
+
implementing a VDU driver to interface with other platforms this mapping
+---+---+---+---+---+---+---+---+
+
must be adhered to.
  |  |  |  |  |  |  |  |
+
 
  |  |  |  |  |  |  |  +---Red
+
===Colour bitmap===
  |  |  |  |  |  |  +-------Green
+
<div class="mw-widebody">
  |  |  |  |  |  +-----------Blue
+
    7  6  5  4  3  2  1  0
  |  |  +---+---+---------------Extension
+
  +---+---+---+---+---+---+---+---+
  |  +---------------------------Border
+
  | L | D | E | F | I | B | G | R |
  +-------------------------------0=Foreground, 1=Background
+
  +---+---+---+---+---+---+---+---+
+
    |  |  |  |  |  |  |  |
+
    |  |  |  |  |  |  |  +---Red
   0 0 x x x b g r - &00+n - foreground colour
+
    |  |  |  |  |  |  +-------Green
   0 1 x x x b g r - &40+n - extension
+
    |  |  |  |  |  +-----------Blue
   1 0 x x x b g r - &80+n - background colour
+
    |  |  |  |  +---------------Intense
   1 1 x x x b g r - &C0+n - border colour
+
    |  |  |  +-------------------Flash
+
    |  |  +-----------------------Extension
BBC implements:
+
    |  +---------------------------Border
   l x x x f b g r - foreground colour
+
    +-------------------------------0=Foreground, 1=Background
 +
 
 +
  This gives:
 +
   0 0 e f i b g r - &00+n - foreground colour
 +
   0 1 e f i b g r - &40+n - extension
 +
   1 0 e f i b g r - &80+n - background colour
 +
   1 1 e f i b g r - &C0+n - border colour
 +
 
 +
  The BBC implements:
 +
   l x x x f b g r - colour
 
           +-------- flash
 
           +-------- flash
+
 
Spectrum implements:
+
  The ZX Spectrum implements:
   l b x f i b g r - foreground colour
+
   l b e f i b g r - colour
     |   | +-------- bright
+
     | | | +-------- bright
     |   +---------- flash
+
     | | +---------- flash
 +
    | +------------ change only flash/bright
 
     +-------------- border
 
     +-------------- border
+
 
Commodore implements
+
  The Commodore implements:
   l b x f i b g r - foreground colour
+
   l b x f i b g r - colour
     |   | +-------- bright
+
     |     +-------- bright
    |  +---------- flash
 
 
     +-------------- border
 
     +-------------- border
+
 
DOS/Windows implements
+
  DOS/Windows implements:
  l x x x i b g r - foreground colour
+
   l x x f i b g r - colour
          +-------- bright
 
 
ANSI Terminal implements
 
   l x x f i b g r - foreground colour
 
 
         | +-------- bright
 
         | +-------- bright
 
         +---------- flash
 
         +---------- flash
+
 
+
  ANSI terminal implements:
+
   l b e f i b g r - colour
Details
+
     | | | +-------- bright
-------
+
     | | +---------- flash
+
     | +------------ underline
Spectrum implements:
+
    +-------------- inverse
   l b x f i b g r - foreground colour
+
</div>
     |   | +-------- bright
+
The BBC uses b3=flash, whereas all platforms other than the BBC uses
     |   +---------- flash
+
b4=flash. For visual compatibility, programs could use 0-7 for non-flashing
     +-------------- border
+
colours and 24-31 for flashing colours. On the BBC these will be flashing
+
colours, on other platforms these will be bright flashing colours where
  %00xxxbgr - &00+num - foreground colour
+
supported.
  %01xxxbgr - &40+num - reserved
+
 
  %10xxxbgr - &80+num - background colour
+
==Implementation details==
  %11xxxbgr - &C0+num - border colour
+
 
+
===Electron/BBC/Master/etc===
      Bit 0 - Red
+
<div class="mw-widebody">
      Bit 1 - Green
+
  0+n &00+n - foreground colour
      Bit 2 - Blue
+
128+n &80+n - background colour
      Bit 3 - Bright
+
 
      Bit 4 - Flash
+
  Fore    Back                      Fore    Back
      Bit 5 - Change colour only, don't change Flash and Bright
+
  ground  ground  Colour          ground  ground   Colour
      Bit 6 - Change Flash and Bright only, don't change colours
+
  0 &00 128 &80 Black             8 &08  136 &88  Flashing Black
      Bit 7 - 0=Set foreground or flash/bright, 1=Set background or border
+
  1 &01  129 &81 Red              9 &09  137 &89  Flashing Red
+
  2 &02 130 &82 Green            10 &0A  138 &8A  Flashing Green
    This results in the colour being set as follows:
+
  3 &03 131 &83 Yellow          11 &0B  139 &8B  Flashing Yellow
   
+
  4 &04 132 &84 Blue            12 &0C  140 &8C  Flashing Blue
      &00+n (0-63)    - text foreground colour
+
  5 &05 133 &85 Magenta          13 &0D  141 &8D  Flashing Magenta
      &40+n (64-127)  - flash and bright without changing colours
+
  6 &06 134 &86 Cyan            14 &0E  142 &8E  Flashing Cyan
      &80+n (128-191) - text background colour
+
  7 &07 135 &87 White            15 &0F  143 &8F  Flashing White
      &C0+n (192-255) - border colour
+
</div>
+
===ZX Spectrum===
        Fore    Back
+
<div class="mw-widebody">
      ground  ground   Border    Colour
+
  0+n  &00+n %000FIBGR - foreground colour, bright and flash
      0 &00   128 &80   192 &C0  Black
+
  32+n  &20+n  %001xxBGR - foreground colour, without changing flash and bright
      1 &01  129 &81   193 &C1  Red
+
  64+n  &40+n  %010xIxxx - bright without changing current colour
      2 &02   130 &82   194 &C2  Green
+
  96+n  &60+n  %011Fxxxx - flash without changing current colour
      3 &03   131 &83   195 &C3  Yellow
+
128+n  &80+n  %100FIBGR - background colour, bright and flash
      4 &04   132 &84   196 &C4  Blue
+
160+n  &A0+n  %101xxBGR - background colour, without changing flash and bright
      5 &05   133 &85   197 &C5  Magenta
+
  192+n  &C0+n %11xxxBGR - border colour
      6 &06   134 &86   198 &C6  Cyan
+
 
      7 &07   135 &87   199 &C7  White
+
  Fore    Back                              Fore    Back
+
  ground ground  Border  Colour          ground ground  Colour
Spectrum Colour Numbers with BBC BASIC support
+
  0 &00  128 &80 192 &C0 Black            16 &10 144 &90 Flashing Black
  ----------------------------------------------
+
   1 &01 129 &81 193 &C1 Red              17 &11 145 &91 Flashing Red
   
+
  2 &02 130 &82 194 &C2 Green            18 &12 146 &92 Flashing Green
  b0: Red
+
  3 &03 131 &83 195 &C3 Yellow          19 &13 147 &93 Flashing Yellow
b1: Green
+
  4 &04 132 &84 196 &C4 Blue            20 &14 148 &94 Flashing Blue
b2: Blue
+
  5 &05  133 &85  197 &C5  Magenta          21 &15  149 &95 Flashing Magenta
  b3: Intense
+
  6 &06 134 &86  198 &C6  Cyan            22 &16  150 &96  Flashing Cyan
  b4: Flash
+
   7 &07  135 &87  199 &C7  White            23 &17  151 &97 Flashing White
b5: 0=change F/I        1=don't change F/I
+
   8 &08  136 &88          Bright Black    24 &18  152 &98  Flashing Bright Black
  b6: 0=change RGB        1=don't change RGB
+
   9 &09  137 &89          Bright Red      25 &19  153 &99 Flashing Bright Red
  b7: 0=foreground or F/I 1=background or border
+
   10 &0A  138 &8A          Bright Green    26 &1A  154 &9A  Flashing Bright Green
   
+
   11 &0B  139 &8B          Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
   
+
   12 &0C  140 &8C          Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
   0 &00 %000FIBGR - foreground colour
+
   13 &0D  141 &8D          Bright Magenta  29 &1D  157 &9D  Flashing Bright Magenta
  32 &20  %001xxBGR - foreground colour, don't change current F and I
+
   14 &0E  142 &8E          Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
  64 &40 %010FIxxx - set F and I without changing current colours
+
   15 &0F 143 &8F          Bright White    31 &1F  159 &9F  Flashing Bright White
  96 &60 %011xxxxx - don't change anything!
+
 
  128 &80 %100FIBGR - background colour
+
   32 &20  160 &A0          Black, without changing flash/bright
  160 &A0 %101xxBGR - background colour, don't change current F and I
+
   33 &21  161 &A1          Red, without changing flash/bright
192 &C0 %110xxBGR - border colour (no F or I anyway)
+
   34 &22  162 &A2          Green, without changing flash/bright
  224 &E0 %111xxBGR - border colour, don't change current F and I
+
   35 &23  163 &A3          Yellow, without changing flash/bright
   
+
   36 &24  164 &A4          Blue, without changing flash/bright
   
+
   37 &25  165 &A5          Magenta, without changing flash/bright
  %000IFBGR - foreground colour
+
  38 &26  166 &A6          Cyan, without changing flash/bright
  -----------------------------
+
  39 &27 167 &A7          White, without changing flash/bright
   0 black ink
+
 
  1 red ink
+
  64 &40                    Bright off      96 &60          Flash off
  2 green ink
+
  72 &48                    Bright on      112 &70          Flash on
  3 yellow ink
+
</div>
  4 blue ink
+
===Commodore===
  5 magenta ink
+
<div class="mw-widebody">
  6 cyan ink
+
  0+n  &00+n - foreground colour
  7 white ink
+
128+n  &80+n - background colour
   
+
192+n  &C0+n - border colour
   8 black ink, bright
+
 
   9 red ink, bright
+
  Fore    Back                              Fore    Back
  10 green ink, bright
+
  ground  ground  Border   Colour          ground  ground   Border   Colour
  11 yellow ink, bright
+
  0 &00  128 &80  192 &C0  Black            8 &08  136 &88  200 &C8  Dark Grey   
  12 blue ink, bright
+
  1 &01 129 &81 193 &C1  Red/Brown        9 &09  137 &89  201 &C9  Bright Red   
  13 magenta ink, bright
+
  2 &02 130 &82  194 &C2  Green            10 &0A  138 &8A  202 &CA  Bright Green 
  14 cyan ink, bright
+
  3 &03  131 &83  195 &C3  Yellow/Orange    11 &0B  139 &8B  203 &CB  Bright Yellow
  15 white ink, bright
+
  4 &04  132 &84  196 &C4 Blue            12 &0C 140 &8C  204 &CC  Bright Blue 
   
+
  5 &05  133 &85 197 &C5  Magenta/Purple  13 &0D  141 &8D  205 &CD  Bright Magenta
   16 black ink, flash
+
  6 &06  134 &86  198 &C6 Cyan            14 &0E 142 &8E 206 &CE Light Grey   
   17 red ink, flash
+
  7 &07 135 &87 199 &C7 Light Grey      15 &0F 143 &8F 207 &CF White       
  18 green ink, flash
+
</div>
   19 yellow ink, flash
+
===DOS/Windows===
  20 blue ink, flash
+
<div class="mw-widebody">
   21 magenta ink, flash
+
  0+n &00+n - foreground colour
   22 cyan ink, flash
+
  128+n &80+n - background colour
   23 white ink, flash
+
 
   
+
  Fore    Back                      Fore    Back
   24 black ink, bright, flash
+
  ground ground  Colour          ground ground  Colour
  25 red ink, bright, flash
+
  0 &00 128 &80 Black            16 &10 144 &90 Flashing Black
   26 green ink, bright, flash
+
  1 &01 129 &81 Red              17 &11 145 &91 Flashing Red
   27 yellow ink, bright, flash
+
  2 &02 130 &82 Green            18 &12 146 &92 Flashing Green
   28 blue ink, bright, flash
+
  3 &03 131 &83 Yellow          19 &13 147 &93 Flashing Yellow
   29 magenta ink, bright, flash
+
  4 &04 132 &84 Blue            20 &14  148 &94  Flashing Blue
  30 cyan ink, bright, flash
+
  5 &05 133 &85 Magenta          21 &15  149 &95  Flashing Magenta
   31 white ink, bright, flash
+
  6 &06  134 &86  Cyan            22 &16  150 &96  Flashing Cyan
   
+
  7 &07 135 &87 White            23 &17 151 &97 Flashing White
%001xxBGR - foreground colour, don't change current F and I
+
  8 &08 136 &88  Bright Black    24 &18 152 &98 Flashing Bright Black
-----------------------------------------------------------
+
  9 &09 137 &89  Bright Red      25 &19  153 &99 Flashing Bright Red
   32 black ink, bright unchanged, flash unchanged
+
  10 &0A 138 &8A  Bright Green    26 &1A  154 &9A  Flashing Bright Green
   33 red ink, bright unchanged, flash unchanged
+
  11 &0B  139 &8B Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
   34 green ink, bright unchanged, flash unchanged
+
  12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
  35 yellow ink, bright unchanged, flash unchanged
+
  13 &0D  141 &8D  Bright Magenta  29 &1D  157 &9D Flashing Bright Magenta
  36 blue ink, bright unchanged, flash unchanged
+
  14 &0E 142 &8E Bright Cyan      30 &1E 158 &9E Flashing Bright Cyan
  37 magenta ink, bright unchanged, flash unchanged
+
  15 &0F 143 &8F Bright White    31 &1F 159 &9F  Flashing Bright White
  38 cyan ink, bright unchanged, flash unchanged
+
</div>
  39 white ink, bright unchanged, flash unchanged
+
===ANSI Terminal===
   
+
<div class="mw-widebody">
  %010FIxxx - set I and F without changing current colours
+
  0+n &00+n - foreground colour
  --------------------------------------------------------
+
128+n  &80+n - background colour
  64 flash off, bright off
+
 
  72 flash off, bright on
+
  Fore    Back                      Fore    Back
  80 flash on, bright off
+
  ground  ground  Colour          ground  ground  Colour
  88 flash on, bright on
+
  0 &00  128 &80  Black            16 &10  144 &90  Flashing Black
   
+
  1 &01 129 &81 Red              17 &11  145 &91  Flashing Red
  %011xxxxx - reserved - don't change current F/I or RGB
+
  2 &02  130 &82  Green            18 &12 146 &92 Flashing Green
  -----------------------------------------------------
+
   3 &03  131 &83  Yellow          19 &13  147 &93  Flashing Yellow
   
+
  4 &04  132 &84  Blue            20 &14  148 &94  Flashing Blue
  %100IFBGR - background colour
+
  5 &05  133 &85  Magenta          21 &15  149 &95  Flashing Magenta
  -----------------------------
+
  6 &06  134 &86  Cyan            22 &16  150 &96 Flashing Cyan
  128 black paper
+
   7 &07  135 &87  White            23 &17  151 &97  Flashing White
129 red paper
+
   8 &08  136 &88  Bright Black    24 &18  152 &98  Flashing Bright Black
  130 green paper
+
   9 &09 137 &89 Bright Red      25 &19 153 &99 Flashing Bright Red
  131 yellow paper
+
   10 &0A  138 &8A  Bright Green    26 &1A  154 &9A  Flashing Bright Green
  132 blue paper
+
   11 &0B  139 &8B  Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
  133 magenta paper
+
   12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
  134 cyan paper
+
   13 &0D  141 &8D  Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
  135 white paper
+
   14 &0E  142 &8E  Bright Cyan     30 &1E  158 &9E  Flashing Bright Cyan
+
   15 &0F  143 &8F  Bright White    31 &1F  159 &9F  Flashing Bright White
136 black paper, bright
+
    
137 red paper, bright
+
   32+n  &20+n      Underlined text
  138 green paper, bright
+
   64+n  &40+n      Inverse text
  139 yellow paper, bright
+
</div>
  140 blue paper, bright
+
 
141 magenta paper, bright
+
==See also==
142 cyan paper, bright
+
* [http://mdfs.net/Info/Comp/BBC/Display/Colours/Physical.htm Physical colour numbers]
  143 white paper, bright
+
* [http://mdfs.net/Software/BBCBasic/Porting/VDUSpecs BBC BASIC Host VDU Interface Specification]
   
+
 
  144 black paper, flash
+
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 23:06, 16 June 2016 (UTC)
  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
 

Latest revision as of 21:11, 17 July 2021

Physical colour numbers are used as the short physical colour in the VDU 19 command, and used in the COLOUR and GCOL commands on platforms without a palette. The colour number is a bitmap of the colour to select. When implementing a VDU driver to interface with other platforms this mapping must be adhered to.

Colour bitmap

   7   6   5   4   3   2   1   0
 +---+---+---+---+---+---+---+---+
 | L | D | E | F | I | B | G | R |
 +---+---+---+---+---+---+---+---+
   |   |   |   |   |   |   |   |
   |   |   |   |   |   |   |   +---Red
   |   |   |   |   |   |   +-------Green
   |   |   |   |   |   +-----------Blue
   |   |   |   |   +---------------Intense
   |   |   |   +-------------------Flash
   |   |   +-----------------------Extension
   |   +---------------------------Border
   +-------------------------------0=Foreground, 1=Background
 
 This gives:
  0 0 e f i b g r - &00+n - foreground colour
  0 1 e f i b g r - &40+n - extension
  1 0 e f i b g r - &80+n - background colour
  1 1 e f i b g r - &C0+n - border colour
 
 The BBC implements:
  l x x x f b g r - colour
          +-------- flash
 
 The ZX Spectrum implements:
  l b e f i b g r - colour
    | | | +-------- bright
    | | +---------- flash
    | +------------ change only flash/bright
    +-------------- border
 
 The Commodore implements:
  l b x f i b g r - colour
    |     +-------- bright
    +-------------- border
 
 DOS/Windows implements:
  l x x f i b g r - colour
        | +-------- bright
        +---------- flash
 
 ANSI terminal implements:
  l b e f i b g r - colour
    | | | +-------- bright
    | | +---------- flash
    | +------------ underline
    +-------------- inverse

The BBC uses b3=flash, whereas all platforms other than the BBC uses b4=flash. For visual compatibility, programs could use 0-7 for non-flashing colours and 24-31 for flashing colours. On the BBC these will be flashing colours, on other platforms these will be bright flashing colours where supported.

Implementation details

Electron/BBC/Master/etc

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black             8 &08  136 &88  Flashing Black
  1 &01  129 &81  Red               9 &09  137 &89  Flashing Red
  2 &02  130 &82  Green            10 &0A  138 &8A  Flashing Green
  3 &03  131 &83  Yellow           11 &0B  139 &8B  Flashing Yellow
  4 &04  132 &84  Blue             12 &0C  140 &8C  Flashing Blue
  5 &05  133 &85  Magenta          13 &0D  141 &8D  Flashing Magenta
  6 &06  134 &86  Cyan             14 &0E  142 &8E  Flashing Cyan
  7 &07  135 &87  White            15 &0F  143 &8F  Flashing White

ZX Spectrum

  0+n  &00+n  %000FIBGR - foreground colour, bright and flash
 32+n  &20+n  %001xxBGR - foreground colour, without changing flash and bright
 64+n  &40+n  %010xIxxx - bright without changing current colour
 96+n  &60+n  %011Fxxxx - flash without changing current colour
128+n  &80+n  %100FIBGR - background colour, bright and flash
160+n  &A0+n  %101xxBGR - background colour, without changing flash and bright
192+n  &C0+n  %11xxxBGR - border colour
 
  Fore    Back                               Fore    Back
 ground  ground   Border   Colour           ground  ground   Colour
  0 &00  128 &80  192 &C0  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  193 &C1  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  194 &C2  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  195 &C3  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  196 &C4  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  197 &C5  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  198 &C6  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  199 &C7  White            23 &17  151 &97  Flashing White
  8 &08  136 &88           Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89           Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A           Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B           Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C           Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D           Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E           Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F           Bright White     31 &1F  159 &9F  Flashing Bright White
 
 32 &20  160 &A0           Black, without changing flash/bright
 33 &21  161 &A1           Red, without changing flash/bright
 34 &22  162 &A2           Green, without changing flash/bright
 35 &23  163 &A3           Yellow, without changing flash/bright
 36 &24  164 &A4           Blue, without changing flash/bright
 37 &25  165 &A5           Magenta, without changing flash/bright
 38 &26  166 &A6           Cyan, without changing flash/bright
 39 &27  167 &A7           White, without changing flash/bright
 
 64 &40                    Bright off       96 &60           Flash off
 72 &48                    Bright on       112 &70           Flash on

Commodore

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

DOS/Windows

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  White            23 &17  151 &97  Flashing White
  8 &08  136 &88  Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89  Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A  Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B  Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D  Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F  Bright White     31 &1F  159 &9F  Flashing Bright White

ANSI Terminal

  0+n  &00+n - foreground colour
128+n  &80+n - background colour
 
  Fore    Back                      Fore    Back
 ground  ground   Colour           ground  ground   Colour
  0 &00  128 &80  Black            16 &10  144 &90  Flashing Black
  1 &01  129 &81  Red              17 &11  145 &91  Flashing Red
  2 &02  130 &82  Green            18 &12  146 &92  Flashing Green
  3 &03  131 &83  Yellow           19 &13  147 &93  Flashing Yellow
  4 &04  132 &84  Blue             20 &14  148 &94  Flashing Blue
  5 &05  133 &85  Magenta          21 &15  149 &95  Flashing Magenta
  6 &06  134 &86  Cyan             22 &16  150 &96  Flashing Cyan
  7 &07  135 &87  White            23 &17  151 &97  Flashing White
  8 &08  136 &88  Bright Black     24 &18  152 &98  Flashing Bright Black
  9 &09  137 &89  Bright Red       25 &19  153 &99  Flashing Bright Red
 10 &0A  138 &8A  Bright Green     26 &1A  154 &9A  Flashing Bright Green
 11 &0B  139 &8B  Bright Yellow    27 &1B  155 &9B  Flashing Bright Yellow
 12 &0C  140 &8C  Bright Blue      28 &1C  156 &9C  Flashing Bright Blue
 13 &0D  141 &8D  Bright Magenta   29 &1D  157 &9D  Flashing Bright Magenta
 14 &0E  142 &8E  Bright Cyan      30 &1E  158 &9E  Flashing Bright Cyan
 15 &0F  143 &8F  Bright White     31 &1F  159 &9F  Flashing Bright White
 
 32+n  &20+n      Underlined text
 64+n  &40+n      Inverse text

See also

Jgharston (talk) 23:06, 16 June 2016 (UTC)