General Control Functions
ConsoleCodes.backspace
— Functionbackspace()
Backspace one column, but not past the beginning of the line.
ConsoleCodes.nextstop
— Functionnextstop()
Goes to the next tab stop or to the end of the line if there is no earlier tab stop.
ConsoleCodes.carriagereturn
— Functioncarriagereturn()
Gives a carriage return.
ConsoleCodes.esc
— Functionesc(v)
Write control bytes v
following the start of a console escape sequence.
ConsoleCodes.reset
— Functionreset()
Reset console controls.
ConsoleCodes.newline
— Functionnewline()
Insert a new line using a console escape sequence.
ConsoleCodes.reversefeed
— Functionreversefeed()
Reverse the console line feed.
ConsoleCodes.savestate
— Functionsavestate()
Save the current console state, includes cursor coordinates, attributes and character sets. The state is saved to an internal OS register that can be restored with restorestate
but is otherwise inaccessible.
ConsoleCodes.restorestate
— Functionrestorestate()
Restore the console state saved by savestate
.
ConsoleCodes.control
— Functioncontrol(c, args...)
Insert a console control sequence with control character c
and arguments args
.
Each argument is inserted into the stream with print
, so typically Integer
types should be provided as arguments.
ConsoleCodes.insertlines
— Functioninsertlines(n)
Insert n
blank lines using a console escape sequence.
ConsoleCodes.deletelines
— Functiondeletelines(n)
Delete n
lines using a console escape sequence.
ConsoleCodes.delete
— Functiondelete(n)
Delete n
characters on the current line using a console escape sequence.
ConsoleCodes.withstyle
— Functionwithstyle(𝒻, io::IO, ss...;
color=nothing, bold=false, italic=false, strike=false, blink=false,
reverse=false, underline=false, background=nothing,
reset=true
)
Call 𝒻(io, ss...)
writing console graphics formatting control sequences before and after as specified.
Note that saving the console state does not save graphic attributes, so the console state prior to printing is lost. If reset=true
, the console graphical reset Graphics.reset()
will be called, completely erasing whatever state the console may have had both prior to and during printing with printstyled
.
Foreground color is specified with color
, background color is specified with background
. If nothing
, the console color state will remain unchanged. Colors can be specified with any of
- An integer between 0 and 255 (256-color)
- A 3-tuple of integers, each between 0 and 255 (24-bit color).
- One of the following
Symbol
s::default, :black, :red, :green, :brown, :blue, :magenta, :cyan, :white
.
ConsoleCodes.printstyled
— Functionprintstyled(io::IO, ss...; kw...)
printstyled(ss...; kw...)
Print arguments ss
with graphical styling provided by console control codes. Similar to Base.prinstyled
but with more features.
If no io
is specified, stdout
will be used.
Internally uses withstyle
, see the documentation of that function for a description of all available options.