theme

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ThemeConfig = map[ThemeContext]string{
	ThemeText:        "white",
	ThemeBorder:      "white",
	ThemeBackground:  "default",
	ThemeStatusInfo:  "white",
	ThemeStatusError: "red",

	ThemeAdapter:             "white",
	ThemeAdapterPowered:      "green",
	ThemeAdapterNotPowered:   "red",
	ThemeAdapterDiscoverable: "aqua",
	ThemeAdapterScanning:     "yellow",
	ThemeAdapterPairable:     "mediumorchid",

	ThemeDevice:                   "white",
	ThemeDeviceType:               "white",
	ThemeDeviceAlias:              "white",
	ThemeDeviceConnected:          "white",
	ThemeDeviceDiscovered:         "white",
	ThemeDeviceProperty:           "grey",
	ThemeDevicePropertyConnected:  "green",
	ThemeDevicePropertyDiscovered: "orange",

	ThemeMenu:     "white",
	ThemeMenuBar:  "default",
	ThemeMenuItem: "white",

	ThemeProgressBar:  "white",
	ThemeProgressText: "white",
}

ThemeConfig stores a list of color for the modifier elements.

Functions

func BackgroundColor

func BackgroundColor(themeContext ThemeContext) tcell.Color

BackgroundColor checks whether the given color is a light or dark color, and returns the appropriate color that is visible on top of the given color.

func ColorName added in v0.2.1

func ColorName(color tcell.Color) string

ColorName returns the name of the provided color.

func ColorWrap

func ColorWrap(elementName ThemeContext, elementContent string, attributes ...string) string

ColorWrap wraps the text content with the modifier element's color.

func GetColor

func GetColor(themeContext ThemeContext) tcell.Color

GetColor returns the color of the modifier element.

func GetElementData added in v0.1.7

func GetElementData() string

GetElementData returns the element types and colors in a tabular format.

func ParseThemeConfig

func ParseThemeConfig(themeConfig map[string]string) error

ParseThemeConfig parses the theme configuration.

Types

type ThemeContext added in v0.1.7

type ThemeContext string

ThemeContext describes the type of context to apply the color into.

const (
	ThemeText                     ThemeContext = "Text"
	ThemeBorder                   ThemeContext = "Border"
	ThemeBackground               ThemeContext = "Background"
	ThemeStatusInfo               ThemeContext = "StatusInfo"
	ThemeStatusError              ThemeContext = "StatusError"
	ThemeAdapter                  ThemeContext = "Adapter"
	ThemeAdapterPowered           ThemeContext = "AdapterPowered"
	ThemeAdapterNotPowered        ThemeContext = "AdapterNotPowered"
	ThemeAdapterDiscoverable      ThemeContext = "AdapterDiscoverable"
	ThemeAdapterScanning          ThemeContext = "AdapterScanning"
	ThemeAdapterPairable          ThemeContext = "AdapterPairable"
	ThemeDevice                   ThemeContext = "Device"
	ThemeDeviceType               ThemeContext = "DeviceType"
	ThemeDeviceAlias              ThemeContext = "DeviceAlias"
	ThemeDeviceConnected          ThemeContext = "DeviceConnected"
	ThemeDeviceDiscovered         ThemeContext = "DeviceDiscovered"
	ThemeDeviceProperty           ThemeContext = "DeviceProperty"
	ThemeDevicePropertyConnected  ThemeContext = "DevicePropertyConnected"
	ThemeDevicePropertyDiscovered ThemeContext = "DevicePropertyDiscovered"
	ThemeMenu                     ThemeContext = "Menu"
	ThemeMenuBar                  ThemeContext = "MenuBar"
	ThemeMenuItem                 ThemeContext = "MenuItem"
	ThemeProgressBar              ThemeContext = "ProgressBar"
	ThemeProgressText             ThemeContext = "ProgressText"
)

The different context types for themes.

Jump to

Keyboard shortcuts

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