v0.1.1 true color extracted to a standalone package, lut256 lazy build
This commit is contained in:
+7
-5
@@ -1,18 +1,19 @@
|
||||
package tui
|
||||
|
||||
import (
|
||||
"github.com/lixenwraith/color"
|
||||
"github.com/lixenwraith/terminal"
|
||||
)
|
||||
|
||||
// InputOpts configures single-line input field
|
||||
type InputOpts struct {
|
||||
Label string
|
||||
LabelFg terminal.RGB
|
||||
LabelFg color.RGB
|
||||
Text string
|
||||
Cursor int // Cursor position in text (rune index)
|
||||
CursorBg terminal.RGB
|
||||
TextFg terminal.RGB
|
||||
Bg terminal.RGB
|
||||
CursorBg color.RGB
|
||||
TextFg color.RGB
|
||||
Bg color.RGB
|
||||
}
|
||||
|
||||
// Input renders labeled text input field on row y, handling cursor display and horizontal scrolling
|
||||
@@ -75,4 +76,5 @@ func (r Region) Input(y int, opts InputOpts) {
|
||||
if cursor == len(runes) && cursor-scroll < inputW {
|
||||
r.Cell(x+cursor-scroll, y, ' ', opts.TextFg, opts.CursorBg, terminal.AttrNone)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user