On the Internet, formats like HTML, SVG and CSS require the specification of colours. These colour specifications have expanded over time to encompass a number of different ways of expressing the intention. Whilst we commonly see named colours (all English names), numbered colours are more exact but come in many forms. For use in RISC OS applications, the conversion process can be shared and standardised, and has been implemented in the WebColours module.
The WebColours module provides interfaces for converting to and from colour schemes used on the World Wide Web and beyond. There are two major forms that are supported, within which there are more specific specification formats:
HTML 4 colours:
CSS colours (specifically CSS 3)
The RGB colours that the WebColours module returns are returned in the standard RISC OS form '&BBGGRR00'. The lower 8 bits are reserved for an alpha component which is not currently supported by the module.
R0 | = | Flags:
| ||||||||
R1 | = | RGB colour in the form &BBGGRR00 | ||||||||
R2 | = | Buffer to write the colour string into | ||||||||
R3 | = | Length of the buffer |
R0-2 | preserved | |
R3 | = | Buffer length written |
This SWI converts the RISC OS colour value into a string. It can either always convert to the numeric format, or use the readable colour names.
R0 | = | Flags:
| ||||||||||||||
R1 | = | Pointer to string to convert | ||||||||||||||
R2 | = | Length of the string (only used if flag bit 1 clear) |
R0 | = | RGB colour in the form &BBGGRR00 |
R1-2 | preserved |
This SWI converts the HTML 4 colour string int a RISC OS colour value. It can either only convert to the numeric format, or may parse the HTML 4 readable colour names.
R0 | = | Flags:
| ||||||||
R1 | = | RGB colour in the form &BBGGRR00 | ||||||||
R2 | = | Buffer to write the colour string into | ||||||||
R3 | = | Length of the buffer |
R0-2 | preserved | |
R3 | = | Buffer length written |
This SWI is not currently supported.
R0 | = | Flags:
| ||||||||||||||
R1 | = | Pointer to string to convert | ||||||||||||||
R2 | = | Length of the string (only used if flag bit 1 clear) |
R0 | = | RGB colour in the form &BBGGRR00 |
R1-2 | preserved |
This SWI converts the CSS 3 colour string into a RISC OS colour value. The colour names can be processed as CSS 3 or just HTML 4 names.
Maintainer(s): | Charles Ferguson <gerph@gerph.org> | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
History: |
| ||||||||||||
Disclaimer: |
© Gerph, 2020. |