state

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var DefaultPalettePath = defaultPalettePath()

Functions

This section is empty.

Types

type Change

type Change uint8

Change represents currently pending state changes

const (
	NoChange Change = 1 << iota
	SelectedChanged
	HueChanged
	SaturationChanged
	ValueChanged
)

func (Change) Includes

func (sc Change) Includes(other ...Change) bool

type PaletteConfig

type PaletteConfig struct {
	Name       string         `toml:"name"`
	Background paletteColor   `toml:"background"`
	Colors     []paletteColor `toml:"color"`
}

type State

type State struct {
	// contains filtered or unexported fields
}

func Load

func Load(path string) (*State, error)

Load attempts to read a stored state from disk. If no stored state exists or is readable, a default State and error will be returned.

func New

func New() *State

func NewDefault

func NewDefault() *State

NewDefault returns a State initialized with default colors

func (*State) Add

func (s *State) Add() (ok bool)

Add adds a new subState after the current position

func (*State) Background

func (s *State) Background() tcell.Color

func (*State) BaseColor

func (s *State) BaseColor() *noire.Color

BaseColor returns the current color at full saturation and brightness

func (*State) Flush

func (s *State) Flush() Change

Return state Change since previous flush

func (*State) HSVString

func (s *State) HSVString() string

func (*State) HexString

func (s *State) HexString() string

func (*State) Hue

func (s *State) Hue() float64

func (*State) IsNew

func (s *State) IsNew() bool

IsNew returns whether this state is newly created. returns false if state was successfully loaded from file.

func (*State) Len

func (s *State) Len() int

func (*State) Name

func (s *State) Name() string

func (*State) Next

func (s *State) Next()

increment substate

func (*State) Path

func (s *State) Path() string

Path returns the persistent filepath for state

func (*State) Pos

func (s *State) Pos() int

func (*State) Prev

func (s *State) Prev()

decrement substate

func (*State) RGBString

func (s *State) RGBString() string

func (*State) Remove

func (s *State) Remove() (ok bool)

Remove removes the subState at the current position

func (*State) Saturation

func (s *State) Saturation() float64

func (*State) Save

func (s *State) Save() error

func (*State) Selected

func (s *State) Selected() *subState

func (*State) SetHue

func (s *State) SetHue(n float64)

func (*State) SetSaturation

func (s *State) SetSaturation(n float64)

func (*State) SetValue

func (s *State) SetValue(n float64)

func (*State) SubColors

func (s *State) SubColors() []tcell.Color

func (*State) TableString

func (s *State) TableString() string

TableString returns an ascii table formatted representation of the current State

func (*State) TermString

func (s *State) TermString() string

func (*State) Value

func (s *State) Value() float64

Jump to

Keyboard shortcuts

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