consoled

Using arsd.terminal.d is recommended as it is more mature and stable.

Provides simple API for coloring and formatting text in arsd.terminal. On Windows OS it uses WinAPI functions, on POSIX systems it uses mainly ANSI codes.

More...

Members

Aliases

Bg
alias Bg = EnumTypedef!(Color, "bg")

Alias for color enum

ConsolePoint
alias ConsolePoint = Tuple!(int, "x", int, "y")

Represents point in console.

Fg
alias Fg = EnumTypedef!(Color, "fg")

Alias for color enum

Enums

CloseType
enum CloseType

Close type.

Color
enum Color
Color
enum Color
ConsoleOutputStream
enum ConsoleOutputStream

Console output stream

FontStyle
enum FontStyle

Console font output style

SpecialKey
enum SpecialKey

Special keys

Functions

addCloseHandler
void addCloseHandler(CloseHandler closeHandler)

Adds handler for console close event.

addCloseHandler
void addCloseHandler(CloseHandler closeHandler)

Adds handler for console close event.

background
Color background()

Current console background color

background
void background(Color color)

Sets console background color

background
void background(Color color)

Sets console background color

background
Color background()

Current console font color

clearScreen
void clearScreen()

Clears console screen

cursorPos
ConsolePoint cursorPos()

Gets cursor position

cursorPos
ConsolePoint cursorPos()

Gets cursor position

cursorVisible
void cursorVisible(bool visible)

Sets cursor visibility

cursorVisible
void cursorVisible(bool visible)

Sets cursor visibility

drawBox
void drawBox(ConsolePoint p1, ConsolePoint p2, char border)

Draws box with specified border character

drawHorizontalLine
void drawHorizontalLine(ConsolePoint pos, int length, char border)

Draws horizontal line with specified fill character

drawVerticalLine
void drawVerticalLine(ConsolePoint pos, int length, char border)

Draws horizontal line with specified fill character

fillArea
void fillArea(ConsolePoint p1, ConsolePoint p2, char fill)

Fills area with specified character

fontStyle
void fontStyle(FontStyle fs)

Sets console font style

fontStyle
FontStyle fontStyle()

Returns console font style

fontStyle
void fontStyle(FontStyle fs)

Sets console font style

foreground
Color foreground()

Current console font color

foreground
void foreground(Color color)

Sets console foreground color

foreground
void foreground(Color color)

Sets console foreground color

foreground
Color foreground()

Current console background color

getch
int getch(bool echo = false)

Reads character without line buffering

getch
int getch(bool echo = false)

Reads character without line buffering

kbhit
bool kbhit()

Checks if any key is pressed.

kbhit
bool kbhit()

Checks if anykey is pressed.

mode
ConsoleInputMode mode()

Gets console mode

mode
void mode(ConsoleInputMode cim)

Sets console mode

mode
ConsoleInputMode mode()

Gets console mode

mode
void mode(ConsoleInputMode cim)

Sets console mode

moveCursorDown
void moveCursorDown(int n = 1)

Moves cursor down by n rows

moveCursorDown
void moveCursorDown(int n = 1)

Moves cursor down by n rows

moveCursorLeft
void moveCursorLeft(int n = 1)

Moves cursor left by n columns

moveCursorLeft
void moveCursorLeft(int n = 1)

Moves cursor left by n columns

moveCursorRight
void moveCursorRight(int n = 1)

Moves cursor right by n columns

moveCursorRight
void moveCursorRight(int n = 1)

Moves cursor right by n columns

moveCursorUp
void moveCursorUp(int n = 1)

Moves cursor up by n rows

moveCursorUp
void moveCursorUp(int n = 1)

Moves cursor up by n rows

outputStream
void outputStream(ConsoleOutputStream cos)

Sets new console output stream

outputStream
void outputStream(ConsoleOutputStream cos)

Sets new console output stream

readPassword
string readPassword(char mask = '*')

Reads password from user

resetColors
void resetColors()

Brings default colors back

resetFontStyle
void resetFontStyle()

Brings font formatting to default

setCursorPos
void setCursorPos(int x, int y)

Sets console position

setCursorPos
void setCursorPos(int x, int y)

Sets console position

size
ConsolePoint size()

Console size

size
ConsolePoint size()

Console size

title
void title(string title)

Sets console title

title
void title(string title)

Sets console title

writeAt
void writeAt(ConsolePoint point, T data)

Writes at specified position

writec
void writec(T params)

Writes text to console and colorizes text

writecln
void writecln(T params)

Writes line to console and goes to newline

Properties

height
int height [@property getter]

Console height

width
int width [@property getter]

Console width

Structs

CloseEvent
struct CloseEvent

Represents close event.

ColorTheme
struct ColorTheme(Color fg, Color bg)

Represents color theme.

ConsoleInputMode
struct ConsoleInputMode

Console input mode

Detailed Description

Important notes:

  • Font styles have no effect on windows platform.
  • Light background colors are not supported. Non-light equivalents are used on Posix platforms.

Meta

Authors

<a href="http://github.com/robik">Robert 'Robik' Pasiński</a>