colour

package
v0.0.0-...-6e0df7b Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(input float64, min, max float64) float64

Types

type Palette

type Palette struct {
	Entries                           []PaletteEntry `json:"entries"`
	Ranges                            []PaletteRange `json:"ranges"`
	CompanyColourLightingContribution float64        `json:"company_colour_lighting_contribution"`
	DefaultBrightness                 float64        `json:"default_brightness"`
	CompanyColourLightingScale        float64        `json:"company_colour_lighting_scale"`
}

func FromJson

func FromJson(handle io.Reader) (p Palette, err error)

func (Palette) GetAnimatedPalette

func (p Palette) GetAnimatedPalette() (pal []RGB)

Get the palette of animated colours

func (*Palette) GetFromReader

func (p *Palette) GetFromReader(handle io.Reader) (err error)

func (Palette) GetGoPalette

func (p Palette) GetGoPalette() (pal color.Palette)

Get a Go palette

func (Palette) GetLitIndexed

func (p Palette) GetLitIndexed(index byte, l float64) (idx byte)

func (Palette) GetLitRGB

func (p Palette) GetLitRGB(index byte, l float64, lighting_weight float64, brightness float64, contrast float64, resolveSpecialColours bool, influence float64) (output RGB)

func (Palette) GetMaskColour

func (p Palette) GetMaskColour(index byte) (msk byte)

func (Palette) GetPrimaryCompanyColourPalette

func (p Palette) GetPrimaryCompanyColourPalette() (pal []RGB)

Get the palette of primary company colours

func (Palette) GetRGB

func (p Palette) GetRGB(index byte, resolveSpecialColours bool) (output RGB)

func (Palette) GetRegularPalette

func (p Palette) GetRegularPalette() (pal []RGB)

Get the palette of non-special colours

func (Palette) GetSecondaryCompanyColourPalette

func (p Palette) GetSecondaryCompanyColourPalette() (pal []RGB)

Get the palette of secondary company colours

func (Palette) GetSmoothness

func (p Palette) GetSmoothness(index byte) (smoothness int)

func (Palette) IsRenderable

func (p Palette) IsRenderable(index byte) bool

func (Palette) IsSpecialColour

func (p Palette) IsSpecialColour(index byte) bool

func (*Palette) SetRanges

func (p *Palette) SetRanges(ranges []PaletteRange) (err error)

type PaletteEntry

type PaletteEntry struct {
	R, G, B byte
	Range   *PaletteRange
}

func (*PaletteEntry) GetRGB

func (pe *PaletteEntry) GetRGB() (output RGB)

func (*PaletteEntry) UnmarshalJSON

func (pe *PaletteEntry) UnmarshalJSON(data []byte) error

type PaletteRange

type PaletteRange struct {
	Start                    byte `json:"start"`
	End                      byte `json:"end"`
	IsPrimaryCompanyColour   bool `json:"is_primary_company_colour"`
	IsSecondaryCompanyColour bool `json:"is_secondary_company_colour"`
	IsAnimatedLight          bool `json:"is_animated_light"`
	IsProcessColour          bool `json:"is_process_colour"`
	Smoothness               int  `json:"smoothness"`
	IsNonRenderable          bool `json:"non_renderable"`
	MaxGapInRegion           int  `json:"max_gap_in_region"`
	ExpectedColourRange      byte `json:"expected_colour_range"`
}

type RGB

type RGB struct {
	R float64
	G float64
	B float64
}

func ClampRGB

func ClampRGB(input RGB) (output RGB)

func FromPaletteEntry

func FromPaletteEntry(p PaletteEntry) RGB

func PermissiveClampRGB

func PermissiveClampRGB(input RGB) (output RGB)

func (RGB) Add

func (rgb RGB) Add(input RGB) (result RGB)

func (*RGB) DivideAndClamp

func (rgb *RGB) DivideAndClamp(divisor float64)

func (*RGB) GetRGBA

func (rgb *RGB) GetRGBA(alpha float64) color.NRGBA64

func (RGB) MultiplyBy

func (rgb RGB) MultiplyBy(value float64) (result RGB)

func (RGB) Subtract

func (rgb RGB) Subtract(input RGB) (result RGB)

Jump to

Keyboard shortcuts

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