ui

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorTitle      = lipgloss.Color("#7D56F4")
	ColorGreen      = lipgloss.Color("#04B575")
	ColorYellow     = lipgloss.Color("#FBBF24")
	ColorRed        = lipgloss.Color("#EF4444")
	ColorSubtle     = lipgloss.Color("#6B7280")
	ColorBorder     = lipgloss.Color("#3F3F46")
	ColorHeader     = lipgloss.Color("#D4D4D8")
	ColorSelectedBg = lipgloss.Color("#3B3B5C")
)
View Source
var (
	TitleStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorTitle)

	PanelStyle = lipgloss.NewStyle().
				Border(lipgloss.RoundedBorder()).
				BorderForeground(ColorBorder).
				Padding(0, 1)

	HeaderStyle = lipgloss.NewStyle().
				Bold(true).
				Foreground(ColorHeader)

	SubtleStyle = lipgloss.NewStyle().
				Foreground(ColorSubtle)

	GreenStyle  = lipgloss.NewStyle().Foreground(ColorGreen)
	YellowStyle = lipgloss.NewStyle().Foreground(ColorYellow)
	RedStyle    = lipgloss.NewStyle().Foreground(ColorRed)
)

Functions

func ApplyTheme

func ApplyTheme(name string)

ApplyTheme switches the global color variables to use the given theme. Falls back to "dark" if the theme name is not recognized.

func AvailableThemes

func AvailableThemes() []string

AvailableThemes returns the names of all built-in themes.

func BarColor

func BarColor(pct float64) lipgloss.Color

func RenderBattery

func RenderBattery(bat metrics.BatteryStats) string

RenderBattery renders the battery indicator. Returns empty if no battery.

func RenderCPU

func RenderCPU(cpu metrics.CPUStats, width int, history []float64) string

func RenderDisk

func RenderDisk(delta metrics.DiskDelta, disk metrics.DiskStats, width int) string

RenderDisk renders the disk panel with I/O throughput and usage.

func RenderGPU

func RenderGPU(stats *gpu.Stats, width int, history []float64) string

RenderGPU renders the GPU panel. Returns an empty string when GPU metrics are unavailable, causing no visual output.

func RenderHelp

func RenderHelp(width int) string

func RenderHelpOverlay

func RenderHelpOverlay(width, height int, version string) string

RenderHelpOverlay renders a full-screen help overlay.

func RenderMemory

func RenderMemory(mem metrics.MemoryStats, load metrics.LoadAvg, width int, history []float64) string

func RenderNetwork

func RenderNetwork(delta metrics.NetworkDelta, width int) string

RenderNetwork renders the network panel. Returns empty if no data.

func RenderProcessDetail

func RenderProcessDetail(d ProcessDetail, width, height int) string

RenderProcessDetail renders a full-screen overlay with extended process info.

func RenderProcesses

func RenderProcesses(procs []metrics.ProcessInfo, state ProcessViewState, width, maxRows int) string

func RenderSparkline

func RenderSparkline(values []float64, maxWidth int, color lipgloss.Color) string

RenderSparkline renders a sparkline from a slice of values (0-100). maxWidth limits the number of characters rendered (uses last N values).

func RenderSparklineCompact

func RenderSparklineCompact(label string, values []float64, maxWidth int) string

RenderSparklineCompact renders a sparkline with a label prefix.

func RenderTemperature

func RenderTemperature(temp metrics.TemperatureStats, width int) string

RenderTemperature renders the temperature panel. Returns an empty string when no sensors are available.

func TempColor

func TempColor(temp float64) lipgloss.Color

TempColor returns a color based on temperature thresholds.

Types

type ProcessDetail

type ProcessDetail struct {
	metrics.ProcessInfo
	Cmdline    string
	NumFDs     int32
	RSS        uint64 // bytes
	VMS        uint64 // bytes
	CreateTime int64  // milliseconds since epoch
}

ProcessDetail holds extended info for the process detail overlay.

type ProcessViewState

type ProcessViewState struct {
	SortBy      metrics.SortField
	SelectedIdx int // -1 = no selection
	SearchQuery string
	Searching   bool
	TreeView    bool
	HideSystem  bool
	TotalProcs  int // total process count before filtering
}

ProcessViewState holds pure rendering state for the process panel.

type Theme

type Theme struct {
	Name       string
	Title      lipgloss.Color
	Green      lipgloss.Color
	Yellow     lipgloss.Color
	Red        lipgloss.Color
	Subtle     lipgloss.Color
	Border     lipgloss.Color
	Header     lipgloss.Color
	SelectedBg lipgloss.Color
}

Theme defines a color palette for the UI.

Jump to

Keyboard shortcuts

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