COLORS
A color on a screen is three amounts of light: red, green and blue. Written in hexadecimal, each amount takes two digits, from 00 (none) to FF (full), so a whole color is six hex digits. 87CEEB is a sky blue, FF0000 is pure red, and 000000 is black. satellite.variable.color holds exactly that, and satellite.variable.colour is its second spelling.
Making a color
On the line that declares a color, the x in front is optional: 000000, x000000, ff00aa and 87ceeb all work. However you write it, a color is shown in capitals with its x, the way a hex number is.
A color can also be see-through. Its transparency is a whole number from 0 (solid) to 99 (almost clear). You can give it after a comma when you write the color, or set it later with .transparency(n). Written on its own, .transparency reads it back.
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.color sky = 87ceeb
satellite.variable.colour ink = x000000, 50
satellite.console.display(sky)
satellite.console.display(ink)
satellite.console.display(ink.transparency)
sky.transparency(40)
satellite.console.display(sky.transparency)
satellite.console.display(sky)
satellite.return(satellite)
}x87CEEB
x000000, 50
50
40
x87CEEB, 40A color with a transparency shows as x000000, 50, just the way you write it.
Changing a color later
On a later line, c = x00ff00 always works, and so do digits that start with a letter, or that have no letters at all, such as c = abcdef and c = 123456. The one shape that needs its x is digits that start with a number and hold a letter, such as 00ff00. The comma works on a later line too.
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.color grass = 00ff00
satellite.console.display(grass)
grass = x228b22
satellite.console.display(grass)
grass = abcdef
satellite.console.display(grass)
grass = 123456, 10
satellite.console.display(grass)
satellite.return(satellite)
}x00FF00
x228B22
xABCDEF
x123456, 10Comparing and converting
== and != compare two colors, and both the digits and the transparency have to match. A color has no order, so < and > are refused, and it has no arithmetic: + on two colors is refused, and the message points you to .number if you want to do sums.
.numberis what the six digits are worth.hexis the six digits, without thex.binaryis its 24 bits.stringis the color as it is shown
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.color red = ff0000
satellite.variable.color also_red = xFF0000
satellite.variable.color glass = ff0000, 30
satellite.console.display(red == also_red)
satellite.console.display(red == glass)
satellite.console.display(red.number)
satellite.console.display(red.hex)
satellite.console.display(red.binary)
satellite.console.display(glass.string)
satellite.return(satellite)
}true
false
16711680
FF0000
111111110000000000000000
xFF0000, 30red and glass have the same digits, but glass is 30 see-through, so they are not equal.
Six digits exactly
A color is always six digits. Five or seven are refused before the program starts:
(satellite)
satellite.capsule satellite.main()
{
satellite.variable.color pink = ff00a
satellite.console.display(pink)
satellite.return(satellite)
}--------------------------------------------------------------------------------
SATELLITE CRITICAL ERROR REPORT
--------------------------------------------------------------------------------
S301: TYPES_DO_NOT_MEET
satl(check): in satellite.main, ERROR: ff00a is 5 hex digits -- a color is
exactly six hex digits, like x00FF00
directory: short.satl:5
syntax: satellite.variable.color pink = ff00a
/\
this operator has no scenario for the two kinds it was given. Nothing was
guessed at, because a guess here is an answer that is wrong and does not say so.
machine code 27 types_do_not_meet -- satl exits with this.
--------------------------------------------------------------------------------A transparency of 100 or more is refused the same way: the most is 99.
Using a color
A color is what you hand to the words that paint text. "OK".foreground(grass) is the word OK in the color grass holds, and six hex digits work there too: "OK".foreground(x00FF00) is OK in green. The color shows when the text reaches a terminal. See COLOR ON THE CONSOLE.
Comparing a color with a bare hex number, such as grass == x228B22, is not built yet. Compare two colors instead, or compare their .number values.
Where next
The FULL REFERENCE lists every color word. Hex numbers themselves are in BINARY AND HEXADECIMAL.
