Documentation
¶
Overview ¶
Package colorapi is the library behind the colorapi command line: the HTTP client, request shaping, and the typed data models for The Color API (thecolorapi.com) — color identification and scheme generation.
Index ¶
Constants ¶
const Host = "www.thecolorapi.com"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to thecolorapi.com over HTTP.
func (*Client) Identify ¶
Identify resolves a color by one of hex, rgb, or hsl query parameters. Exactly one of hex/rgb/hsl must be non-empty.
type ColorInfo ¶
type ColorInfo struct {
Name string `kit:"id" json:"name"`
Hex string `json:"hex"`
RGB string `json:"rgb"`
HSL string `json:"hsl"`
HSV string `json:"hsv"`
CMYK string `json:"cmyk"`
Exact bool `json:"exact_match"`
}
ColorInfo holds the identified properties of a color.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Timeout time.Duration
Retries int
}
Config holds all tunable parameters for the Client.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Domain ¶
type Domain struct{}
Domain is the colorapi driver.
func (Domain) Classify ¶
Classify turns an input into the canonical (type, id). Kit derives URI types from struct names: ColorInfo → colorinfo, SchemeColor → schemecolor.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.