colorpicker

package module
v0.0.0-...-19fadcf Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: MIT, Unlicense Imports: 16 Imported by: 0

README

Color Input

A Gio library for color input widgets

TODO

  • The tone of a color is not what is shown under the control of the picker
    • Maybe we need to use the HSL colorspace instead of HSV
    • Maybe the gradient can be drawn differently
  • Make the control of the tone and hue picker align to the middle of a mouse event
  • Fix issue with size of hue slider when the width in pixels is not a multiple of 6

License

MIT & Unlicense

Author

Werner Laurensse

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HsvToRgb

func HsvToRgb(hsv HSVColor) color.NRGBA

Types

type AlphaSlider

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

func NewAlphaSlider

func NewAlphaSlider() *AlphaSlider

func (*AlphaSlider) Changed

func (s *AlphaSlider) Changed() bool

func (*AlphaSlider) Color

func (s *AlphaSlider) Color() color.NRGBA

func (*AlphaSlider) Layout

func (s *AlphaSlider) Layout(gtx layout.Context) layout.Dimensions

func (*AlphaSlider) SetColor

func (s *AlphaSlider) SetColor(col color.NRGBA)

type ColorInput

type ColorInput interface {
	Layout(gtx layout.Context) layout.Dimensions
	Changed() bool
	SetColor(col color.NRGBA)
	Color() color.NRGBA
}

type ColorSelection

type ColorSelection struct {
	Dropdown     layout.Direction
	CornerRadius unit.Value
	Inset        layout.Inset
	Input        *Mux
	// contains filtered or unexported fields
}

func NewColorSelection

func NewColorSelection(th *material.Theme, drop layout.Direction, inputs ...ColorInput) *ColorSelection

func (*ColorSelection) Changed

func (cf *ColorSelection) Changed() bool

func (*ColorSelection) Click

func (cf *ColorSelection) Click()

Click programmatically

func (*ColorSelection) Color

func (cf *ColorSelection) Color() color.NRGBA

func (*ColorSelection) Layout

func (cf *ColorSelection) Layout(gtx layout.Context) layout.Dimensions

func (*ColorSelection) SetColor

func (cf *ColorSelection) SetColor(col color.NRGBA)

type HSVColor

type HSVColor struct {
	// H stands for hue and is the rgb portion of the model,
	// expressed as a number from 0 to 360 degrees:
	// Red falls between 0 and 60 degrees.
	// Yellow falls between 61 and 120 degrees.
	// Green falls between 121 and 180 degrees.
	// Cyan falls between 181 and 240 degrees.
	// Blue falls between 241 and 300 degrees.
	// Magenta falls between 301 and 360 degrees.
	H float32
	// S stands for saturation and describes the amount of gray in a particular rgb,from 0 to 1.
	// Reducing this component toward zero introduces more gray and produces a faded effect.
	S float32
	// V stands for value and works in conjunction with saturation and describes the brightness or intensity of the rgb,
	// from 0 to 1, where 0 is completely black, and 1 is the brightest and reveals the most rgb.
	V float32
}

HSV is a cylindrical rgb model that remaps the RGB primary colors into dimensions that are easier for humans to understand.

func RgbToHsv

func RgbToHsv(rgb color.NRGBA) HSVColor

type HexEditor

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

func NewHexEditor

func NewHexEditor(th *material.Theme) *HexEditor

func (*HexEditor) Changed

func (e *HexEditor) Changed() bool

func (*HexEditor) Color

func (e *HexEditor) Color() color.NRGBA

func (*HexEditor) Layout

func (e *HexEditor) Layout(gtx layout.Context) layout.Dimensions

func (*HexEditor) SetColor

func (e *HexEditor) SetColor(col color.NRGBA)

type HsvEditor

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

func NewHsvEditor

func NewHsvEditor(th *material.Theme) *HsvEditor

func (*HsvEditor) Changed

func (e *HsvEditor) Changed() bool

func (*HsvEditor) Color

func (e *HsvEditor) Color() color.NRGBA

func (*HsvEditor) Layout

func (e *HsvEditor) Layout(gtx layout.Context) layout.Dimensions

func (*HsvEditor) SetColor

func (e *HsvEditor) SetColor(col color.NRGBA)

type Mux

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

func NewMux

func NewMux(inputs ...ColorInput) *Mux

func (*Mux) Changed

func (m *Mux) Changed() bool

func (*Mux) Color

func (m *Mux) Color() color.NRGBA

func (*Mux) Layout

func (m *Mux) Layout(gtx layout.Context) layout.Dimensions

func (*Mux) SetColor

func (m *Mux) SetColor(col color.NRGBA)

type Picker

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

func NewPicker

func NewPicker(th *material.Theme) *Picker

func (*Picker) Changed

func (p *Picker) Changed() bool

func (*Picker) Color

func (p *Picker) Color() color.NRGBA

func (*Picker) Layout

func (p *Picker) Layout(gtx layout.Context) layout.Dimensions

func (*Picker) SetColor

func (p *Picker) SetColor(col color.NRGBA)

type Position

type Position struct {
	X float32
	Y float32
	// contains filtered or unexported fields
}

func (*Position) Changed

func (p *Position) Changed() bool

Changed reports whether the value has changed since the last call to Changed.

func (*Position) Layout

func (p *Position) Layout(gtx layout.Context, pointerMargin int, min, max f32.Point) layout.Dimensions

func (*Position) Pos

func (p *Position) Pos() f32.Point

Pos reports the selected position.

type RgbEditor

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

func NewRgbEditor

func NewRgbEditor(th *material.Theme) *RgbEditor

func (*RgbEditor) Changed

func (e *RgbEditor) Changed() bool

func (*RgbEditor) Color

func (e *RgbEditor) Color() color.NRGBA

func (*RgbEditor) Layout

func (e *RgbEditor) Layout(gtx layout.Context) layout.Dimensions

func (*RgbEditor) SetColor

func (e *RgbEditor) SetColor(col color.NRGBA)

type Toggle

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

func NewToggle

func NewToggle(toggle *widget.Clickable, options ...ColorInput) *Toggle

func (*Toggle) Changed

func (t *Toggle) Changed() bool

func (*Toggle) Color

func (t *Toggle) Color() color.NRGBA

func (*Toggle) Layout

func (t *Toggle) Layout(gtx layout.Context) layout.Dimensions

func (*Toggle) SetColor

func (t *Toggle) SetColor(col color.NRGBA)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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