COLOR ON THE CONSOLE

Plain text gets the job done, but colour makes a program easier to read at a glance: green for “it worked”, orange for “careful”. Satellite gives you three ways to colour what your program shows, plus a few words about the screen itself.

A colour is written as six hex digits after an x, two each for red, green and blue: xFF0000 is red, x00FF00 is green, xFF8800 is orange. You can also keep one in a satellite.variable.color (or satellite.variable.colour, both spellings work) and use its name. COLORS explains colours in full.

The output boxes on this page show plain text. When satl writes into a pipe or a file, as it does when these examples are checked, the colours are left out and only the words go through. At a terminal, you see the colours.

Styling one line

satellite.console.display takes named options after the value, each written name=value:

  • foreground= the colour of the text
  • background= the colour behind it
  • bold=satellite.bool.true and italic=satellite.bool.true

The style lasts for that one line, and the next line is plain again.

styled_lines.satlSATELLITE 004 Download
One line in orange and bold, one in a colour held by name
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.console.display("careful", foreground=xFF8800, bold=satellite.bool.true)
    satellite.variable.color sky = x87CEEB
    satellite.console.display("a clear day", foreground=x000000, background=sky)
    satellite.console.display("a thought", italic=satellite.bool.true)
    satellite.console.display("and this line is plain")
    satellite.return(satellite)
}
OUTPUT
careful
a clear day
a thought
and this line is plain

A colour written straight into the line must be six hex digits. foreground=xFFF or foreground="red" is refused with S301 before a single line of the program runs, so a typo never waits until halfway through to show itself.

Colouring one word

Sometimes only one word should stand out. A string has its own .foreground(c) and .background(c), which answer the same string in that colour. Join it into a line like any other string:

status.satlSATELLITE 004 Download
Only the OK is green
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.string ok = "OK".foreground(x00FF00)
    satellite.console.display("status: " + ok)
    satellite.variable.color warning = xFF8800
    satellite.console.display("disk: " + "nearly full".foreground(warning))
    satellite.console.display(ok == "OK")
    satellite.return(satellite)
}
OUTPUT
status: OK
disk: nearly full
false

Why is the last line false? Because the colour is really part of the string. It is stored as the terminal’s own colour codes around the letters, so ok is not the same two letters as "OK". Display leaves those codes out when it writes into a pipe or a file, or when the NO_COLOR setting is on. A string you save into a file yourself keeps them, so colour your words at the moment you show them.

Colouring every line after

satellite.console.foreground(c) sets the colour for every line display writes from then on, and satellite.console.background(c) does the same behind the text. Written with empty brackets, satellite.console.foreground() puts the terminal’s own colour back. A line’s own foreground= still wins while it is set.

green_console.satlSATELLITE 004 Download
Every line green until you say stop
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.console.foreground(x33FF33)
    satellite.console.display("every line is green now")
    satellite.console.display("this one too")
    satellite.console.display("except this one", foreground=xFF0000)
    satellite.console.foreground()
    satellite.console.display("and back to normal")
    satellite.return(satellite)
}
OUTPUT
every line is green now
this one too
except this one
and back to normal

This colours your program’s lines. To change the colours of the whole terminal window, empty rows included, see THE TERMINAL.

The screen: width, height, clear and home

satellite.console.width and satellite.console.height, with no brackets, answer how many characters fit across the terminal and how many lines fit down it. They are asked fresh every time, so they follow the window when someone resizes it. When there is no terminal, they answer 80 and 24, which is what the example below shows because it was checked without one:

screen_size.satlSATELLITE 004 Download
How big is the screen?
satellite.include(satellite)

satellite.capsule satellite.main()
{
    satellite.variable.number across = satellite.console.width
    satellite.variable.number down = satellite.console.height
    satellite.console.display("the screen is " + across.to_string() + " characters across")
    satellite.console.display("and " + down.to_string() + " lines down")
    satellite.return(satellite)
}
OUTPUT
the screen is 80 characters across
and 24 lines down

Two more words move things on the screen:

  • satellite.console.clear() empties the screen and puts the cursor in the top-left corner.
  • satellite.console.home() only moves the cursor to the top-left corner and leaves the screen as it is, so the next thing you display is drawn over the last.

Both write the terminal’s own codes for this, even when the output goes into a file.

Where next

Every option and colour word is in the FULL REFERENCE. For more on display itself, read DISPLAYING TEXT, and for colour values, COLORS.

You may also like...

1 Response

  1. September 24, 2026

    […] 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. […]

Leave a Reply

Your email address will not be published. Required fields are marked *