extract

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 13 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

Overview

Package extract runs the external color extractor that feeds theming: wallust, matugen, or pywal over the theming monitor's wallpaper (crates/wayle-wallpaper/src/types/color_extractor).

lys-shell does not compute palettes itself. It invokes the configured tool with exactly the arguments (and, for wallust, exactly the generated config and template) the Rust shell does, so the tool writes the same palette to the same cache file:

matugen -> MatugenColorsPath (the tool's --json stdout, saved by lys-shell)
wallust -> WallustColorsPath (written by wallust through the template)
pywal   -> PywalColorsPath   (pywal's own ~/.cache/wal/colors.json)

Theme providers read those files (crates/wayle-styling palette_provider) and re-read them whenever the wallpaper service reports a finished extraction (wallpaper.Service.Extracted and the ColorsExtracted D-Bus signal).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorsPath

func ColorsPath(t Tool) (string, bool, error)

ColorsPath is the cache file the given tool leaves its palette in; false for None.

func Extract

func Extract(ctx context.Context, cfg Config, image string) error

Extract runs the configured tool over image and leaves the palette in the tool's cache file. None is a no-op.

func MatugenColorsPath

func MatugenColorsPath() (string, error)

MatugenColorsPath is where lys-shell saves matugen's JSON output ($XDG_CACHE_HOME/lys-shell/matugen-colors.json); the lys-shell cache dir is created on demand.

func PywalColorsPath

func PywalColorsPath() (string, error)

PywalColorsPath is pywal's own output ($XDG_CACHE_HOME/wal/colors.json); nothing is created, pywal owns that directory.

func WallustColorsPath

func WallustColorsPath() (string, error)

WallustColorsPath is the wallust template's target ($XDG_CACHE_HOME/lys-shell/wallust-colors.json); the lys-shell cache dir is created on demand.

Types

type CommandError

type CommandError struct {
	Tool Tool
	Err  error
}

CommandError is a tool that could not be started (not installed, not executable): ColorExtractionCommandFailed.

func (*CommandError) Error

func (e *CommandError) Error() string

func (*CommandError) Unwrap

func (e *CommandError) Unwrap() error

type Config

type Config struct {
	Tool Tool

	MatugenScheme      MatugenScheme
	MatugenContrast    float64 // -1.0 to 1.0
	MatugenSourceColor uint8
	MatugenLight       bool

	WallustPalette       WallustPalette
	WallustSaturation    uint8 // 0-100, 0 disables the boost
	WallustCheckContrast bool
	WallustBackend       WallustBackend
	WallustColorspace    WallustColorspace
	WallustApplyGlobally bool

	PywalSaturation    float64 // 0.0-1.0
	PywalContrast      float64 // 1.0-21.0
	PywalLight         bool
	PywalApplyGlobally bool
}

Config is the tool and its parameters (ColorExtractorConfig). The ranged fields hold values the config loader already clamped to the schema ranges; MatugenSourceColor is clamped to 0-3 here, as the Rust extract does.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig is ColorExtractorConfig::default().

func FromConfig

func FromConfig(c config.ColorExtractorConfig) Config

FromConfig is the extraction config the [styling] keys describe.

type FailedError

type FailedError struct {
	Tool   Tool
	Stderr string
}

FailedError is a tool that exited unsuccessfully; Stderr is its trimmed standard error (ColorExtractionFailed).

func (*FailedError) Error

func (e *FailedError) Error() string

type MatugenScheme

type MatugenScheme = config.MatugenScheme

MatugenScheme is the matugen color scheme.

type PathError

type PathError struct {
	Context string
	Err     error
}

PathError is a lys-shell data/cache path that could not be resolved or written (ConfigPathError).

func (*PathError) Error

func (e *PathError) Error() string

func (*PathError) Unwrap

func (e *PathError) Unwrap() error

type Tool

type Tool uint8

Tool is the external program that extracts a palette from an image (ColorExtractor in crates/wayle-wallpaper/src/types/color_extractor). None disables extraction.

const (
	Wallust Tool = iota
	Matugen
	Pywal
	None
)

Extraction tools. Wallust is the Rust default.

func ParseTool

func ParseTool(s string) (Tool, error)

ParseTool reads a tool name case-insensitively, accepting the Rust FromStr aliases "wal" (pywal) and "disabled" (none).

func ToolFor

func ToolFor(p config.ThemeProvider) Tool

ToolFor is the extractor a theme provider needs (build_extractor_config): the static lys-shell provider extracts nothing.

func (Tool) String

func (t Tool) String() string

String is the tool's lowercase name, as the Rust Display writes it.

type WallustBackend

type WallustBackend = config.WallustBackend

WallustBackend is the wallust sampling backend.

type WallustColorspace

type WallustColorspace = config.WallustColorspace

WallustColorspace is the wallust color space.

type WallustPalette

type WallustPalette = config.WallustPalette

WallustPalette is the wallust palette mode.

Jump to

Keyboard shortcuts

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