library

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 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

Index

Constants

View Source
const DefaultShortcut = "Ctrl+Alt+C"

DefaultShortcut is the pick shortcut a new library starts with.

View Source
const RecentLimit = 20

Variables

View Source
var ErrInvalidState = errors.New("unsupported color data version or preferences")
View Source
var ErrReadOnly = errors.New("existing color data could not be read; preserving the original file")

Functions

func Open

func Open(path string) (*Store, State, error)

Types

type Language

type Language string
const (
	LanguageSystem      Language = ""
	LanguageEnglish     Language = "en"
	LanguageSimplified  Language = "zh-Hans"
	LanguageTraditional Language = "zh-Hant"
)

func (Language) Valid

func (language Language) Valid() bool

type State

type State struct {
	Version  int           `json:"version"`
	Format   colour.Format `json:"format"`
	Shortcut string        `json:"shortcut"`
	Theme    Theme         `json:"theme"`
	Language Language      `json:"language"`
	// MenuBarHidden is true once the user turns the menu bar icon off; the zero
	// value keeps it, as files saved before the setting existed do.
	MenuBarHidden bool `json:"menu_bar_hidden"`
	// DockHidden is true once the user takes Dipo out of the Dock; the zero
	// value keeps it there, as files saved before the setting existed do.
	DockHidden bool `json:"dock_hidden"`
	// NoAutoCopy is true once the user turns off copying a picked color; the zero
	// value copies, as files saved before the setting existed do.
	NoAutoCopy bool           `json:"no_auto_copy"`
	Recent     []colour.Color `json:"recent"`
	Favorites  []colour.Color `json:"favorites"`
}

func New

func New() State

func (*State) ClearRecent

func (state *State) ClearRecent()

func (*State) Favorite

func (state *State) Favorite(value colour.Color) bool

func (*State) Picked

func (state *State) Picked(value colour.Color)

func (*State) ToggleFavorite

func (state *State) ToggleFavorite(value colour.Color)

type Store

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

func (*Store) Save

func (store *Store) Save(state State) (saveError error)

type Theme

type Theme string
const (
	ThemeSystem Theme = "system"
	ThemeLight  Theme = "light"
	ThemeDark   Theme = "dark"
)

func (Theme) Valid

func (theme Theme) Valid() bool

Jump to

Keyboard shortcuts

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