colorpicker

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 18 Imported by: 1 module, 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

Overview

Package colorpicker is the magnifier-loupe color picker (crates/lys-shell/src/shell/color_picker): a frozen-frame layer surface per monitor with a zoom loupe that follows the pointer - the magnified pixels around it, a crosshair on the exact pixel a click picks, a hex readout, and a row of recently picked swatches. A click samples that pixel; Escape cancels. The screenshot host captures the frames and hands them over (it owns the capture path), and the portal's Screenshot.PickColor reaches it over dev.stubbe.lys.Screenshot1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HistoryPath

func HistoryPath() string

HistoryPath is the persisted swatch file: $XDG_DATA_HOME/lys-shell/color-history, else ~/.local/share/lys-shell/color-history. Empty when neither is an absolute path.

Types

type Picker

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

Picker is the picker component. Request is its entry point; the rest runs on the lys-ui loop goroutine.

func New

func New(a *app.Application, gate *regionoverlay.Gate, outputs func() []*app.Output, font render.Font, historyPath string) *Picker

New builds the picker. gate is the shell's one capture gate; font is the readout's monospace bold face; the history loads from historyPath (HistoryPath for the real one).

func (*Picker) Request

func (p *Picker) Request(ctx context.Context, frames regionoverlay.Frames) (RGB, bool, error)

Request opens the picker over the frozen frames (keyed by connector), which frames captures once the gate admits the request, and blocks until a click picks a pixel (ok), or the user cancels or ctx ends (not ok, no error). A monitor without a frame gets no surface; when no frame matches any monitor there is nothing to pick from, and that is an error naming both, not a cancel. While another session holds the gate the request opens nothing, takes no frames and answers regionoverlay.ErrBusy. Call it from any goroutine but the loop's.

type RGB

type RGB struct{ R, G, B uint8 }

RGB is one 8-bit color.

func (RGB) Float

func (c RGB) Float() (r, g, b float64)

Float is the color as sRGB channels in [0, 1], the PickColor reply.

func (RGB) Hex

func (c RGB) Hex() string

Hex is the color as #RRGGBB.

Jump to

Keyboard shortcuts

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