gamut: github.com/muesli/gamut Index | Files | Directories

package gamut

import "github.com/muesli/gamut"

Index

Package Files

colors.go gamut.go generator.go

func Analogous Uses

func Analogous(c color.Color) []color.Color

Analogous returns the analogous values for any given color

func Blends Uses

func Blends(c1, c2 color.Color, count int) []color.Color

Blends returns a slice of interpolated colors, blended between two colors

func Complementary Uses

func Complementary(c color.Color) color.Color

Complementary returns the complementary value for any given color

func Contrast Uses

func Contrast(c color.Color) color.Color

Contrast returns the color with the most contrast (hence either black or white)

func Cool Uses

func Cool(c color.Color) bool

Cool returns whether a color is considered to have a cool temperature

func Darker Uses

func Darker(c color.Color, percent float64) color.Color

Darker returns a darker version of the specified color

func Generate Uses

func Generate(count int, generator ColorGenerator) ([]color.Color, error)

Generate returns a slice with the requested amount of colors, generated by the provided ColorGenerator.

func Hex Uses

func Hex(s string) color.Color

Hex returns the color encoded by a hex-string, e.g. "#ABCDEF"

func HueOffset Uses

func HueOffset(c color.Color, degrees int) color.Color

HueOffset returns color with a different hue angle

func Lighter Uses

func Lighter(c color.Color, percent float64) color.Color

Lighter returns a lighter version of the specified color

func Monochromatic Uses

func Monochromatic(c color.Color, count int) []color.Color

Monochromatic returns the specified amount of monochromatic colors based on a given color's hues

func Quadratic Uses

func Quadratic(c color.Color) []color.Color

Quadratic returns the quadratic values for any given color

func Shades Uses

func Shades(c color.Color, count int) []color.Color

Shades returns the specified amount of a color's shades

func SplitComplementary Uses

func SplitComplementary(c color.Color) []color.Color

SplitComplementary returns the split complementary values for any given color

func Tetradic Uses

func Tetradic(c1 color.Color, c2 color.Color) []color.Color

Tetradic returns the tetradic values for any given color

func Tints Uses

func Tints(c color.Color, count int) []color.Color

Tints returns the specified amount of a color's tints

func Tones Uses

func Tones(c color.Color, count int) []color.Color

Tones returns the specified amount of a color's tone

func Triadic Uses

func Triadic(c color.Color) []color.Color

Triadic returns the triadic values for any given color

func Warm Uses

func Warm(c color.Color) bool

Warm returns whether a color is considered to have a warm temperature

type BroadGranularity Uses

type BroadGranularity struct {
}

BroadGranularity is used for wider color spaces, e.g. by the PastelGenerator

func (BroadGranularity) Granularity Uses

func (g BroadGranularity) Granularity() (l, c float64)

Granularity returns BroadGranularity's default values

type Color Uses

type Color struct {
    Name      string
    Color     color.Color
    Reference string
}

A Color is a color including its name and reference URL

type ColorGenerator Uses

type ColorGenerator interface {
    Valid(col colorful.Color) bool
    Granularity() (l, c float64)
}

A ColorGenerator checks whether a point in the three dimensional CIELab space is suitable for color generation.

type ColorObservation Uses

type ColorObservation struct {
    colorful.Color
}

ColorObservation is a wrapper around colorful.Color, implementing the clusters.Observation interface

func (ColorObservation) Coordinates Uses

func (c ColorObservation) Coordinates() clusters.Coordinates

Coordinates returns the data points of a Lab color value

func (ColorObservation) Distance Uses

func (c ColorObservation) Distance(pos clusters.Coordinates) float64

Distance calculates the distance between two ColorObservations in the Lab color space

type Colors Uses

type Colors []Color

Colors is a slice of colors

type FineGranularity Uses

type FineGranularity struct {
}

FineGranularity is used for tighter color spaces, e.g. by the SimilarHueGenerator

func (FineGranularity) Granularity Uses

func (g FineGranularity) Granularity() (l, c float64)

Granularity returns FineGranularity's default values

type HappyGenerator Uses

type HappyGenerator struct {
    BroadGranularity
}

HappyGenerator produces "happy" colors

func (HappyGenerator) Valid Uses

func (cc HappyGenerator) Valid(col colorful.Color) bool

Valid returns true if the color is considered a "happy" color

type Palette Uses

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

A Palette is a collection of colors

func (*Palette) AddColors Uses

func (g *Palette) AddColors(cc Colors)

AddColors adds colors to the palette

func (Palette) Clamped Uses

func (g Palette) Clamped(cc []color.Color) Colors

Clamped expects a slice of colors and returns a slice of the nearest matching colors from the palette

func (Palette) Colors Uses

func (g Palette) Colors() Colors

Colors returns the Palette's colors

func (Palette) Filter Uses

func (g Palette) Filter(name string) Colors

Filter returns colors matching name

func (Palette) MixedWith Uses

func (g Palette) MixedWith(p Palette) Palette

MixedWith mixes two palettes

func (Palette) Name Uses

func (g Palette) Name(color color.Color) (Colors, float64)

Name returns the name of the closest matching color

type PastelGenerator Uses

type PastelGenerator struct {
    BroadGranularity
}

PastelGenerator produces "pastel" colors

func (PastelGenerator) Valid Uses

func (cc PastelGenerator) Valid(col colorful.Color) bool

Valid returns true if the color is considered a "pastel" color

type SimilarHueGenerator Uses

type SimilarHueGenerator struct {
    FineGranularity
    Color color.Color
}

SimilarHueGenerator produces colors with a similar hue as the given color

func (SimilarHueGenerator) Valid Uses

func (gen SimilarHueGenerator) Valid(col colorful.Color) bool

Valid returns true if the given color has a similar hue as the original color

type WarmGenerator Uses

type WarmGenerator struct {
    BroadGranularity
}

WarmGenerator produces "warm" colors

func (WarmGenerator) Valid Uses

func (cc WarmGenerator) Valid(col colorful.Color) bool

Valid returns true if the color is considered a "warm" color

Directories

PathSynopsis
palette
theme

Package gamut imports 8 packages (graph) and is imported by 2 packages. Updated 2018-11-18. Refresh now. Tools for package owners.