coloris: bitbucket.org/briiC/coloris Index | Files | Directories

package coloris

import "bitbucket.org/briiC/coloris"

Index

Package Files

Collection.go Color.go ColorList.go Image.go coloris.go palettes.go

Variables

var Palette_ColorNames12 = map[string]string{
    "#000000": "Black",
    "#ffffff": "White",
    "#808080": "Gray",
    "#c41414": "Red",
    "#00ff00": "Green Lime",
    "#2874E6": "Blue",
    "#FFFF00": "Yellow",
    "#FF681F": "Orange",
    "#9d3909": "Brown",
    "#BAE9F3": "Light Blue",
    "#FF00FF": "Pink",
    "#DAFC4F": "Canary",
    "#228B22": "Green",
    "#881e88": "Purple",
}

Palette_ColorNames12 - Main 12 colors

var Palette_ColorNames26 = map[string]string{
    "#000000": "Black",
    "#FFFFFF": "White",
    "#808080": "Gray",
    "#0000FF": "Blue",
    "#2874E6": "Royal Blue",
    "#BAE9F3": "Light Blue",
    "#808000": "Olive",
    "#A7C261": "Celery",
    "#008000": "Green",
    "#00FF00": "Lime Green",
    "#DAFC4F": "Canary",
    "#F0E891": "Khaki",
    "#8e1c1c": "Maroon",
    "#B44848": "Chestnut",
    "#B5651D": "Brown",
    "#CC8454": "Raw Sienna",
    "#FDD9B5": "Apricot",
    "#800080": "Purple",
    "#6658B6": "Blue Violet",
    "#C285DB": "Lavender",
    "#FF00FF": "Pink",
    "#FFAACC": "Carnation Pink",
    "#DA3163": "Cerise Red",
    "#FF0000": "Red",
    "#FF4800": "Red Orange",
    "#FF681F": "Orange",
    "#FF9900": "Yellow Orange",
    "#FFCC00": "Golden Yellow",
    "#FFFF00": "Yellow",
}

Palette_ColorNames26 - Main 26 colors

var Palette_ColorNames3 = map[string]string{
    "#000000": "Black",
    "#ffffff": "White",
    "#c41414": "Red",
    "#228B22": "Green",
    "#2874E6": "Blue",
}

Palette_ColorNames3 - Main 3 colors

var Palette_ColorNamesMAX = map[string]string{ /* 1566 elements not displayed */

}

Palette_ColorNamesMAX - Colors with all names

var Palette_Default = Palette_ColorNames12

Palette_Default - default color map

type Collection Uses

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

Collection of color lists

func NewCollection Uses

func NewCollection(im *Image) *Collection

NewCollection - Collection and initialize lists

func (*Collection) Add Uses

func (col *Collection) Add(_c color.Color)

Add - add color

func (*Collection) CollectStats Uses

func (col *Collection) CollectStats()

CollectStats - trigger stats gathering from lists

func (*Collection) Find Uses

func (col *Collection) Find(c *Color) *Color

Find - find color by given color can be used to chekc if color already exists

type Color Uses

type Color struct {
    Count         int // color px count on image
    Percents      float64
    ColorfulColor colorful.Color
    Name          string // color name
    NameHex       string // exact color hex
    // contains filtered or unexported fields
}

Color - coloris color type

func DominantColor Uses

func DominantColor(fpath string, palette map[string]string) *Color

DominantColor - get one color that are mostly used If two color on same count use first as comes

func NewColor Uses

func NewColor(_c color.Color) *Color

NewColor - get package color struct

func (*Color) Print Uses

func (c *Color) Print()

Print color fields

func (*Color) SetName Uses

func (c *Color) SetName() string

SetName - find name for given color

type ColorList Uses

type ColorList []*Color

ColorList - color list of colors

func AllColors Uses

func AllColors(fpath string, palette map[string]string) ColorList

AllColors - Return all collected colors from image

func BytesToAllColors Uses

func BytesToAllColors(buf []byte, palette map[string]string) ColorList

BytesToAllColors - Return all collected colors from bytes

func TopColors Uses

func TopColors(fpath string, limit int, palette map[string]string) ColorList

TopColors - Return top n colors from image

func (*ColorList) FindByName Uses

func (clist *ColorList) FindByName(name string) *Color

FindByName - is already exists in list

func (ColorList) Len Uses

func (clist ColorList) Len() int

Len is part of sort.Interface.

func (ColorList) Less Uses

func (clist ColorList) Less(i, j int) bool

Less is part of sort.Interface. We use count as the value to sort by

func (ColorList) Print Uses

func (clist ColorList) Print()

Print colors

func (ColorList) Swap Uses

func (clist ColorList) Swap(i, j int)

Swap is part of sort.Interface.

type Image Uses

type Image struct {
    Palette    map[string]string // use these colors to detect color names
    SkipColors []string
    Collection *Collection
    // contains filtered or unexported fields
}

Image data

func NewImage Uses

func NewImage(fpath string, palette map[string]string) *Image

NewImage - load and process image

func NewImageFromBytes Uses

func NewImageFromBytes(buf []byte, palette map[string]string) *Image

NewImageFromBytes - load and process image

func (*Image) AllColors Uses

func (im *Image) AllColors() ColorList

AllColors - Return all collected colors from image

func (*Image) DominantColor Uses

func (im *Image) DominantColor() *Color

DominantColor - get one color that are mostly used If two color on same count use first as comes

func (*Image) Process Uses

func (im *Image) Process(fpath string) error

Process - from image path

func (*Image) ProcessBytes Uses

func (im *Image) ProcessBytes(freader io.Reader) error

ProcessBytes - from bytes

func (*Image) TopColors Uses

func (im *Image) TopColors(limit int) ColorList

TopColors - Return top n colors from image

Directories

PathSynopsis
example

Package coloris imports 11 packages (graph) and is imported by 1 packages. Updated 2019-04-25. Refresh now. Tools for package owners.