ui

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OkButtonExecute = "Execute"
	OkButtonPrint   = "Print"
)

Variables

View Source
var (
	ErrInvalidTheme = errors.New("invalid theme")
)

Functions

func ApplyConfig

func ApplyConfig(cfg Config, system *system.System)

Types

type Config

type Config struct {
	Theme string `yaml:"theme" head_comment:"The theme defines the terminal colors used by Snipkit.\nAvailable themes:default,dracula."`
}

func DefaultConfig

func DefaultConfig() Config

func (*Config) GetSelectedTheme

func (c *Config) GetSelectedTheme(system *system.System) ThemeValues

type NamedTheme

type NamedTheme struct {
	Name   string      `yaml:"name"`
	Values ThemeValues `yaml:"values" head_comment:"A color can be created from a color name (W3C name) or by a hex value in the format #ffffff."`
}

type OkButton

type OkButton string

type Terminal

type Terminal interface {
	ApplyConfig(cfg Config, system *system.System)
	PrintMessage(message string)
	PrintError(message string)
	Confirm(message string) bool
	OpenEditor(path string, preferredEditor string)
	ShowLookup(snippets []model.Snippet) int
	ShowParameterForm(parameters []model.Parameter, okButton OkButton) ([]string, bool)
}

func NewTerminal

func NewTerminal(options ...TerminalOption) Terminal

type TerminalOption

type TerminalOption interface {
	// contains filtered or unexported methods
}

TerminalOption configures a Terminal.

func WithScreen

func WithScreen(screen tcell.Screen) TerminalOption

WithScreen sets the screen for tview.

func WithStdio

func WithStdio(stdio terminal.Stdio) TerminalOption

WithStdio sets the stdio for the terminal.

type ThemeValues

type ThemeValues struct {
	BackgroundColor                              string `yaml:"backgroundColor"`
	BorderColor                                  string `yaml:"borderColor"`
	BorderTitleColor                             string `yaml:"borderTitleColor"`
	PreviewColorSchemeName                       string `yaml:"previewColorSchemeName"`
	PreviewApplyMainBackground                   bool   `yaml:"previewApplyMainBackground"`
	PreviewOverwriteBackgroundColor              string `yaml:"previewOverwriteBackgroundColor"`
	PreviewDefaultTextColor                      string `yaml:"previewDefaultTextColor"`
	ItemTextColor                                string `yaml:"itemTextColor"`
	SelectedItemTextColor                        string `yaml:"selectedItemTextColor"`
	SelectedItemBackgroundColor                  string `yaml:"selectedItemBackgroundColor"`
	ItemHighlightMatchBackgroundColor            string `yaml:"itemHighlightMatchBackgroundColor"`
	ItemHighlightMatchTextColor                  string `yaml:"itemHighlightMatchTextColor"`
	CounterTextColor                             string `yaml:"counterTextColor"`
	LookupInputTextColor                         string `yaml:"lookupInputTextColor"`
	LookupInputPlaceholderColor                  string `yaml:"lookupInputPlaceholderColor"`
	LookupInputBackgroundColor                   string `yaml:"lookupInputBackgroundColor"`
	ParametersLabelTextColor                     string `yaml:"parametersLabelTextColor"`
	ParametersFieldBackgroundColor               string `yaml:"parametersFieldBackgroundColor"`
	ParametersFieldTextColor                     string `yaml:"parametersFieldTextColor"`
	ParameterAutocompleteBackgroundColor         string `yaml:"parameterAutocompleteBackgroundColor"`
	ParameterAutocompleteTextColor               string `yaml:"parameterAutocompleteTextColor"`
	ParameterAutocompleteSelectedBackgroundColor string `yaml:"parameterAutocompleteSelectedBackgroundColor"`
	ParameterAutocompleteSelectedTextColor       string `yaml:"parameterAutocompleteSelectedTextColor"`
	SelectedButtonBackgroundColor                string `yaml:"selectedButtonBackgroundColor"`
	SelectedButtonTextColor                      string `yaml:"selectedButtonTextColor"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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