package vt100 implements a quick-and-dirty programmable ANSI terminal emulator. You could, for example, use it to run a program like nethack that expects a terminal as a subprocess. It tracks the position of the cursor, colors, and various other aspects of the terminal's state, and allows you to inspect them. We do very much mean the dirty part. It's not that we think it might have bugs. It's that we're SURE it does. Currently, we only handle raw mode, with no cooked mode features like scrolling. We also misinterpret some of the control codes, which may or may not matter for your purpose.
Package duit is a pure go, cross-platform, MIT-licensed, UI toolkit for developers. The examples/ directory has small code examples for working with duit and its UIs. Examples are the recommended starting point. Start with NewDUI to create a DUI: essentially a window and all the UI state. The user interface consists of a hierarchy of "UIs" like Box, Scroll, Button, Label, etc. They are called UIs, after the interface UI they all implement. The zero structs for UIs have sane default behaviour so you only have to fill in the fields you need. UIs are kept/wrapped in a Kid, to track their layout/draw state. Use NewKids() to build up the UIs for your application. You won't see much of the Kid-types/functions otherwise, unless you implement a new UI. You are in charge of the main event loop, receiving mouse/keyboard/window events from the dui.Inputs channel, and typically passing them on unchanged to dui.Input. All callbacks and functions on UIs are called from inside dui.Input. From there you can also safely change the the UIs, no locking required. After changing a UI you are responsible for calling MarkLayout or MarkDraw to tell duit the UI needs a new layout or draw. This may sound like more work, but this tradeoff keeps the API small and easy to use. If you need to change the UI from a goroutine outside of the main loop, e.g. for blocking calls, you can send a function that makes those modifications on the dui.Call channel, which will be run on the main channel through dui.Inputs. After handling an input, duit will layout or draw as necessary, no need to render explicitly. Embedding a UI into your own data structure is often an easy way to build up UI hiearchies. Scroll and Edit show a scrollbar. Use button 1 on the scrollbar to scroll up, button 3 to scroll down. If you click more near the top, you scroll less. More near the bottom, more. Button 2 scrolls to the absolute place, where you clicked. Button 4 and 5 are wheel up and wheel down, and also scroll less/more depending on position in the UI.
Package scrollphat provides a helper library for interacting with a Pimoroni Scroll pHAT HD device: https://shop.pimoroni.com/products/scroll-phat-hd The library depends on the periph.io framework for low level device communication. There are two primary ways that the library allows you to interact with the device: Display wraps the Driver (or any other struct providing appropriate functionality), and extends it with higher level capabilities, such as an auto-expanding internal buffer, scrolling, flipping, etc. In most cases, the Display offers a safer and more fully-featured way to interact with the device. Driver abstracts the low level I2C hardware device, and handles all communication. This does include some basic drawing functionality such as SetPixel, SetBrightness, and supports rotation. It's possible to use the Driver directly in your projects. This can be particularly useful in performance-critical situations where you want to incur minimum overhead.
Package scrollphathd provides a helper library for interacting with a Pimoroni Scroll pHAT HD device: https://shop.pimoroni.com/products/scroll-phat-hd The library depends on the periph.io framework for low level device communication. There are two primary ways that the library allows you to interact with the device: Display wraps the Driver (or any other struct providing appropriate functionality), and extends it with higher level capabilities, such as an auto-expanding internal buffer, scrolling, flipping, etc. In most cases, the Display offers a safer and more fully-featured way to interact with the device. Driver abstracts the low level I2C hardware device, and handles all communication. This does include some basic drawing functionality such as SetPixel, SetBrightness, and supports rotation. It's possible to use the Driver directly in your projects. This can be particularly useful in performance-critical situations where you want to incur minimum overhead.
Package scrollphathd provides a helper library for interacting with a Pimoroni Scroll pHAT HD device: https://shop.pimoroni.com/products/scroll-phat-hd The library depends on the periph.io framework for low level device communication. There are two primary ways that the library allows you to interact with the device: Display wraps the Driver (or any other struct providing appropriate functionality), and extends it with higher level capabilities, such as an auto-expanding internal buffer, scrolling, flipping, etc. In most cases, the Display offers a safer and more fully-featured way to interact with the device. Driver abstracts the low level I2C hardware device, and handles all communication. This does include some basic drawing functionality such as SetPixel, SetBrightness, and supports rotation. It's possible to use the Driver directly in your projects. This can be particularly useful in performance-critical situations where you want to incur minimum overhead.