flipperui

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF0000"))

ErrStyle is the style of the error message

Functions

func New

func New(fz *recfz.FlipperZero, screenUpdate <-chan ScreenMsg, opts ...FlipperOpts) tea.Model

New constructs a new flipper model.

func UpdateScreen

func UpdateScreen(updates chan<- ScreenMsg) func(frame flipper.ScreenFrame)

UpdateScreen renders the terminal screen based on the flipper screen. It also returns the flipper screen as an image. This function is intended to be used as a callback for the flipper.

Types

type FlipperOpts added in v0.6.1

type FlipperOpts func(*Model)

FlipperOpts represents an optional configuration for the flipper model.

func WithBgColor added in v0.6.1

func WithBgColor(color string) FlipperOpts

WithBgColor sets the background color of the flipper screen.

func WithFgColor added in v0.6.1

func WithFgColor(color string) FlipperOpts

WithFgColor sets the foreground color of the flipper screen.

func WithScreenshotResolution added in v0.6.1

func WithScreenshotResolution(width, height int) FlipperOpts

WithScreenshotResolution sets the resolution of the screenshot.

type Model

type Model struct {

	// Style is the style of the flipper screen
	Style lipgloss.Style
	// contains filtered or unexported fields
}

Model represents the flipper model. It also implements the bubbletea.Model interface.

func (Model) Init

func (m Model) Init() tea.Cmd

Init is the bubbletea init function. the initial listenScreenUpdate command is started here.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update is the bubbletea update function and handles all tea.Msgs.

func (Model) View

func (m Model) View() string

View renders the flipper screen or an error message if there was an error.

type ScreenMsg added in v0.6.0

type ScreenMsg struct {
	// contains filtered or unexported fields
}

ScreenMsg is a message that is sent when the flipper sends a screen update.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL