Documentation
¶
Overview ¶
Package theme manages viewkit's process-global palette, styles, and screen background rendering.
Index ¶
- Constants
- Variables
- func AppMargin(body string) string
- func Bullet(msg string) string
- func DisplayName(key string) string
- func FillLine(c lipgloss.TerminalColor, width int) string
- func Icon(icon string, hue int) string
- func Keys() []string
- func PadBlock(c lipgloss.TerminalColor, width, rows int, lines ...string) string
- func Register(key, name string, p Palette)
- func Screen(body string, width, height int) string
- func SeverityColor(s Severity) lipgloss.TerminalColor
- func SeverityGlyph(s Severity) string
- func StripBg() lipgloss.TerminalColor
- func StripBlock(width int, lines ...string) string
- func StripBold(fg lipgloss.TerminalColor, s string) string
- func StripText(fg lipgloss.TerminalColor, s string) string
- func Success(msg string) string
- func Use(t Theme)
- type Palette
- type Severity
- type Theme
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 PadBlock ¶ added in v0.0.3
func PadBlock(c lipgloss.TerminalColor, width, rows int, lines ...string) string
func SeverityColor ¶ added in v0.0.4
func SeverityColor(s Severity) lipgloss.TerminalColor
func SeverityGlyph ¶ added in v0.0.4
func StripBg ¶ added in v0.0.4
func StripBg() lipgloss.TerminalColor
func StripBlock ¶ added in v0.0.4
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)
}
Output:
Types ¶
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
}
Click to show internal directories.
Click to hide internal directories.