theme

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 2 Imported by: 4 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package theme manages viewkit's process-global palette, styles, and screen background rendering.

Index

Examples

Constants

View Source
const (
	BodyWidth    = 81
	MinBodyWidth = 24

	MinScreenWidth     = 80
	MinBodyHeight      = 35
	TallBodyHeight     = 46
	AppMarginY         = 1
	AppMarginX         = 2
	ScreenPaddingWidth = AppMarginX*2 + 4
	MinScreenBodyWidth = MinScreenWidth - ScreenPaddingWidth

	RuleWidth = BodyWidth + 4
)
View Source
const (
	DefaultTooNarrowTitle = "TERMINAL TOO NARROW"
	DefaultTooNarrowNeed  = "Need at least %d columns."
	DefaultTooNarrowBody  = "Current width: %s columns. Resize the terminal to at least %d characters wide to use this screen."
)

Variables

View Source
var (
	TitleSty  lipgloss.Style
	AccentSty lipgloss.Style
	DimSty    lipgloss.Style
	ValSty    lipgloss.Style
	KeySty    lipgloss.Style
	CanSty    lipgloss.Style
	CantSty   lipgloss.Style

	AppFrame lipgloss.Style

	PanelSty      lipgloss.Style
	PanelFocusSty lipgloss.Style
	PanelTitleSty lipgloss.Style
	CardSty       lipgloss.Style

	NotifPositiveSty lipgloss.Style
	NotifNeutralSty  lipgloss.Style
	NotifWarningSty  lipgloss.Style
	NotifNegativeSty lipgloss.Style
	NotifIdleSty     lipgloss.Style
	NotifTitleSty    lipgloss.Style

	Series []lipgloss.Style
)

Functions

func DisplayName

func DisplayName(key string) string

func Keys

func Keys() []string

func Screen

func Screen(body string, width, height int) string

func Use

func Use(t Theme)
Example
package main

import (
	"github.com/codyconfer/viewkit/theme"
)

func main() {
	defer theme.Use(theme.Default())

	if th, ok := theme.Named("monokai"); ok {
		theme.Use(th)
	}

	body := theme.Cur().Accent.Render("ready")
	_ = theme.Screen(body, theme.MinScreenWidth, theme.MinBodyHeight)
}

Types

type Palette

type Palette struct {
	Accent   lipgloss.Color
	Border   lipgloss.Color
	Muted    lipgloss.Color
	Text     lipgloss.Color
	Selected lipgloss.Color
	Success  lipgloss.Color
	Warning  lipgloss.Color
	Failure  lipgloss.Color
	Info     lipgloss.Color
	Series2  lipgloss.Color
	Bg       lipgloss.Color
}

type Theme

type Theme struct {
	Title  lipgloss.Style
	Accent lipgloss.Style
	Dim    lipgloss.Style
	Val    lipgloss.Style
	Key    lipgloss.Style
	Can    lipgloss.Style
	Cant   lipgloss.Style

	Panel      lipgloss.Style
	PanelFocus lipgloss.Style
	PanelTitle lipgloss.Style
	Card       lipgloss.Style
	AppFrame   lipgloss.Style

	NotifPositive lipgloss.Style
	NotifNeutral  lipgloss.Style
	NotifWarning  lipgloss.Style
	NotifNegative lipgloss.Style
	NotifIdle     lipgloss.Style
	NotifTitle    lipgloss.Style

	Series []lipgloss.Style

	Bg lipgloss.Color

	TooNarrowTitle string
	TooNarrowNeed  string
	TooNarrowBody  string
}

func Cur

func Cur() *Theme

func Default

func Default() Theme

func Named

func Named(key string) (Theme, bool)

func New

func New(p Palette) Theme

Jump to

Keyboard shortcuts

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