meshgradient

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package meshgradient fills a view with a mesh gradient: a grid of points, each with a color, blended smoothly between them. Move the points off their grid and the colors bend with them.

nimbus native plugin add mesh-gradient

meshgradient.View{
	Columns: 3, Rows: 3,
	Colors: []ui.Color{
		teal, teal, sky,
		coral, sand, sky,
		coral, coral, sand,
	},
	Style: ui.Style{Grow: 1},
}

Go works out the blend, so it looks the same on both phones; the phone draws it stretched to the view's frame.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type View

type View struct {
	Columns, Rows int // points across and down; each at least 2
	// Points are where each point sits, row by row from the top left, in
	// the view's unit square: (0, 0) top left, (1, 1) bottom right. Nil
	// spaces them evenly. Move inner points to bend the colors; keep edge
	// points on their edge, or the corners show through.
	Points []ui.Point
	Colors []ui.Color // one per point, row by row
	Detail int        // steps between two points; 0 means 16
	Style  ui.Style   // its size and place on the screen
}

View is a mesh gradient.

func (View) Render

func (v View) Render(c *ui.Ctx) ui.Component

Render draws it.

Jump to

Keyboard shortcuts

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