COLOUR

From BeebWiki
Revision as of 13:00, 15 February 2024 by Jgharston (talk | contribs) (.)
Jump to: navigation, search

initial draft

 Text colour command
 COLOUR n                VDU 17,n
 COLOUR l,p              VDU 19,l,p,0,0,0
 COLOUR r,g,b            Select logical colour mapped nearest to (r,g,b)
 COLOUR l,r,g,b          VDU 19,l,16,r,g,b or VDU 19,l,24,r,g,b if l<0
 COLOUR l,r,g,b,a        Map logical colour to (r,g,b) and alpha channel
 
 COLOUR ON n             VDU 17,128+n
 COLOUR ON r,g,b         Set text background to colour mapped nearest to (r,g,b)
 COLOUR r,g,b ON n       Set foreground nearest to (r,g,b) and background to n
 COLOUR r,g,b, ON x,y,z  Set foreground nearest to (r,g,b) and background nearest to (x,y,z)
 Text colour function
 =COLOUR(r,g,b)          Return logical colour mapped nearest to (r,g,b)
 
 Implementation
 The COLOUR r,g,b command are implemented in an implementation-specific manner.
 They could be implemented by reading the mapped colour number then sending a
 VDU 17 sequence:
 COLOUR r,g,b:           COLOUR COLOUR(r,g,b) so results in VDU 17,n
 COLOUR ON r,g,b:        COLOUR 128+COLOUR(r,g,b) so results in VDU 17,n
 COLOUR r,g,b ON x,y,z   COLOUR COLOUR(r,b):COLOUR 128+COLOUR (x,y,z) so VDU 17,n,17,m