color

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package color defines the Color interface, the ByteColor type which implements it, the Parser interface, and the ByteColorParser type which implements it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteColor

type ByteColor byte

ByteColor represents a color value using a byte. It implements the Color interface.

func (ByteColor) Equals

func (bc ByteColor) Equals(c Color) bool

Equals returns whether this Color equals c.

type ByteColorParser

type ByteColorParser struct {
	DefaultColor ByteColor
}

ByteColorParser parses a single-byte string to a ByteColor. It implements the Parser interface.

func (*ByteColorParser) ParseColor

func (parser *ByteColorParser) ParseColor(s string) (Color, error)

ParseColor parses s and returns a Color.

Errors

common.ErrInvalidColor: Will be returned if the color is not recognized by this parser.

type Color

type Color interface {
	// Equals returns whether this Color equals c.
	Equals(c Color) bool
}

Color represents a color value.

There is no requirement on the underlying implementation as long as it is supported by the canvas which uses it.

type Parser

type Parser interface {
	// ParseColor parses s and returns a Color.
	//
	// Errors
	//
	// common.ErrInvalidColor:
	// Will be returned if the color is not recognized by this parser.
	//
	ParseColor(s string) (Color, error)
}

Parser represents a color parser.

Jump to

Keyboard shortcuts

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