Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/solidiquis/ansigo
Ansigo offers a convenient way to detect key-presses and control the terminal's font, color, and cursor with ease 🦄
https://github.com/solidiquis/ansigo
ansi go golang terminal vt100
Last synced: 6 days ago
JSON representation
Ansigo offers a convenient way to detect key-presses and control the terminal's font, color, and cursor with ease 🦄
- Host: GitHub
- URL: https://github.com/solidiquis/ansigo
- Owner: solidiquis
- License: mit
- Created: 2021-03-27T01:16:58.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-10T18:15:43.000Z (over 3 years ago)
- Last Synced: 2024-06-21T18:14:04.751Z (5 months ago)
- Topics: ansi, go, golang, terminal, vt100
- Language: Go
- Homepage:
- Size: 924 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ansigo
A library to make the controlling of ANSI terminal emulators' fonts, colors, and cursors, a little less painful — also can be used to detect key presses in the terminal.Documentation can be found at https://pkg.go.dev/github.com/solidiquis/ansigo
## Installation
```
$ go get github.com/solidiquis/ansigo
```## Demo
Moving the cursor around the screen Vim-style:
```go
package mainimport (
ansi "github.com/solidiquis/ansigo"
)func main() {
ansi.EraseScreen()
ansi.CursorSetPos(0, 0)stdin := make(chan string, 1)
go ansi.GetChar(stdin)for {
switch <-stdin {
case "h":
ansi.CursorBackward(1)
case "j":
ansi.CursorDown(1)
case "k":
ansi.CursorUp(1)
case "l":
ansi.CursorForward(1)
}
}
}
```