1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-25 13:48:50 +08:00

Updated Terminal API (markdown)

Jakub Sobon 2019-02-24 17:08:44 -05:00
parent bb69a0261d
commit 48599fe01e

@ -2,7 +2,7 @@
[![Doc Status](https://godoc.org/github.com/mum4k/termdash/terminal/terminalapi?status.png)](https://godoc.org/github.com/mum4k/termdash/terminal/terminalapi)
The [terminalapi](https://github.com/mum4k/termdash/tree/master/terminal/terminalapi) package exposes types that are common to all terminal implementations.
The [terminalapi](https://github.com/mum4k/termdash/tree/master/terminal/terminalapi) package exposes types that are common to all terminal implementations. This abstraction was created so that users of Termdash can choose which low-level terminal library they prefer.
The public API surface of this package consists of the following:
@ -12,18 +12,20 @@ All terminal implementations must implement this interface.
## [terminalapi.ColorMode](https://github.com/mum4k/termdash/blob/ffbf88caeddb1735dcf2a5f735eec80dc9cf9fe7/terminal/terminalapi/color_mode.go#L19-L20)
The **ColorMode** property specifies the amount of colors that can be displayed on a terminal and how are they addressed.
The **ColorMode** property specifies which colors can be displayed on the terminal and how are they addressed.
Refer to the following pages which provide a list of colors and their numbers:
- https://jonasjacek.github.io/colors/
- https://superuser.com/questions/783656/whats-the-deal-with-terminal-colors
Colors are set as options on terminal cells. Refer to the [[Cell API|cell-api]] for more details.
## [terminalapi.Event](https://github.com/mum4k/termdash/blob/ffbf88caeddb1735dcf2a5f735eec80dc9cf9fe7/terminal/terminalapi/event.go#L28-L31)
This interface represents an input terminal event, which can be one of the following events:
- A keyboard event.
- A mouse event.
- A terminal resize event.
- A keyboard event when a key is pressed.
- A mouse event when a mouse button is pressed or the mouse wheel is rolled.
- A terminal resize event when the size of the terminal window changes.
- An error that occurs at the terminal layer or during event processing.