From ComputerCraft Wiki
Jump to: navigation, search

Grid Redstone.png  Function term.blit
Added by ComputerCraft 1.74, term.blit() functions in nearly the same manner as term.write(), but instead of using the current text and background colours, it accepts additional strings specifying colour codes for each individual character. Although it is no faster than term.write() in its own right, in some circumstances it can reduce code length and speed execution by removing the need to make multiple term.setTextColor() / term.setBackgroundColor() calls.

Each character in the text/background colour strings must be a valid "paint" symbol from ComputerCraft's list of colours (eg, "a" for purple, "3" for light blue, "e" for red, etc), in the same order as the text characters they are to be applied to. Spaces may also be used: in the text colour string, they'll be taken for white, whereas in the background colour string they'll be taken for black. The three strings must each be of the same length. Note that only advanced systems can render in colour - if unsupported shades are requested on a normal system, no error will occur but black will be used instead.
Syntax term.blit(string text, string text colours, string background colours)
Returns nil
Part of ComputerCraft
API term


Grid paper.png  Example
Writes the letter "a", using a blue text colour ("b"), and a brown background colour ("c").
Output a

Grid paper.png  Example
Writes RAINBOW!, making use of all colours.

Grid paper.png  Example
Writes "Hello, World!", using black text on a white background.
term.blit("Hello, World!","fffffffffffff","0000000000000")
Output Hello, World!