Documentation
¶
Overview ¶
Package palette summarizes the colors of a website.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Painters = map[string]Painter{ "band (horizontal)": &BandPainter{}, "band (vertical)": &BandPainter{vertical: true}, "circle": &CirclePainter{}, "circle (reverse)": &CirclePainter{reverse: true}, }
Painters is a map of Painter implementations with names as keys.
Functions ¶
This section is empty.
Types ¶
type BandPainter ¶
type BandPainter struct {
// contains filtered or unexported fields
}
BandPainter draws a rectangle for each color. The width is based on the score of each color.
func (*BandPainter) Paint ¶
func (painter *BandPainter) Paint(p *Palette, s *svg.SVG, job PaintJob)
Paint implements Painter
type CirclePainter ¶
type CirclePainter struct {
// contains filtered or unexported fields
}
CirclePainter draws a circle for each color. The radius is based on the score of each color. Only circles, no ellipses are drawn: use width == height
func (*CirclePainter) Paint ¶
func (painter *CirclePainter) Paint(p *Palette, s *svg.SVG, job PaintJob)
Paint implements Painter
type ColorScore ¶
type ColorScore struct { Score int Color *colorful.Color }
ColorScore is the resulting score for a specific color.
func (ColorScore) String ¶
func (c ColorScore) String() string
type PaintJob ¶
type PaintJob struct {
// Maximum width and height in pixels
Width, Height int
// Maximum amount of unique colors to keep
Max int
}
PaintJob contains common options for all Painters.
type Palette ¶
type Palette []*ColorScore
Palette is a list of Colors sorted by score. The score is calculated by anything that implements the palette.Score interface.
func Group ¶
Group a CML (ColorMention list) as a Palette. Mentions are grouped by color and scored with the specified Scorer implementation. If scorer is nil, it will fall back on palette.SumScore