mirror of
https://github.com/golang/go
synced 2024-11-22 04:24:39 -07:00
image/color/palette: move Plan9Palette and WebSafePalette out of the
image/color package into their own package. They require some non- trivial init-time code (interface conversions, currently 40KiB of text) that would otherwise burden any Go program that imported image/color. R=r CC=golang-dev https://golang.org/cl/13256046
This commit is contained in:
parent
5d6ea6f70e
commit
aeb8b45866
@ -1,497 +0,0 @@
|
|||||||
// generated by go run gen.go; DO NOT EDIT
|
|
||||||
|
|
||||||
package color
|
|
||||||
|
|
||||||
// Plan9Palette is a 256-color palette that partitions the 24-bit RGB space
|
|
||||||
// into 4×4×4 subdivision, with 4 shades in each subcube. Compared to the
|
|
||||||
// WebSafePalette, the idea is to reduce the color resolution by dicing the
|
|
||||||
// color cube into fewer cells, and to use the extra space to increase the
|
|
||||||
// intensity resolution. This results in 16 gray shades (4 gray subcubes with
|
|
||||||
// 4 samples in each), 13 shades of each primary and secondary color (3
|
|
||||||
// subcubes with 4 samples plus black) and a reasonable selection of colors
|
|
||||||
// covering the rest of the color cube. The advantage is better representation
|
|
||||||
// of continuous tones.
|
|
||||||
//
|
|
||||||
// This palette was used in the Plan 9 Operating System, described at
|
|
||||||
// http://plan9.bell-labs.com/magic/man2html/6/color
|
|
||||||
var Plan9Palette = []Color{
|
|
||||||
RGBA{0x00, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x44, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x88, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x44, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x44, 0x44, 0xff},
|
|
||||||
RGBA{0x00, 0x44, 0x88, 0xff},
|
|
||||||
RGBA{0x00, 0x44, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x88, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x88, 0x44, 0xff},
|
|
||||||
RGBA{0x00, 0x88, 0x88, 0xff},
|
|
||||||
RGBA{0x00, 0x88, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x44, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x88, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0xdd, 0xdd, 0xff},
|
|
||||||
RGBA{0x11, 0x11, 0x11, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x55, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xdd, 0xff},
|
|
||||||
RGBA{0x00, 0x55, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x55, 0x55, 0xff},
|
|
||||||
RGBA{0x00, 0x4c, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x49, 0xdd, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x4c, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x93, 0xdd, 0xff},
|
|
||||||
RGBA{0x00, 0xdd, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xdd, 0x49, 0xff},
|
|
||||||
RGBA{0x00, 0xdd, 0x93, 0xff},
|
|
||||||
RGBA{0x00, 0xee, 0x9e, 0xff},
|
|
||||||
RGBA{0x00, 0xee, 0xee, 0xff},
|
|
||||||
RGBA{0x22, 0x22, 0x22, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xaa, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xee, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x55, 0xaa, 0xff},
|
|
||||||
RGBA{0x00, 0x4f, 0xee, 0xff},
|
|
||||||
RGBA{0x00, 0xaa, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xaa, 0x55, 0xff},
|
|
||||||
RGBA{0x00, 0xaa, 0xaa, 0xff},
|
|
||||||
RGBA{0x00, 0x9e, 0xee, 0xff},
|
|
||||||
RGBA{0x00, 0xee, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xee, 0x4f, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x55, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0xaa, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x77, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xbb, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0x77, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x77, 0x77, 0xff},
|
|
||||||
RGBA{0x00, 0x5d, 0xbb, 0xff},
|
|
||||||
RGBA{0x00, 0x55, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0xbb, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xbb, 0x5d, 0xff},
|
|
||||||
RGBA{0x00, 0xbb, 0xbb, 0xff},
|
|
||||||
RGBA{0x00, 0xaa, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x44, 0x00, 0x44, 0xff},
|
|
||||||
RGBA{0x44, 0x00, 0x88, 0xff},
|
|
||||||
RGBA{0x44, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x44, 0x44, 0x00, 0xff},
|
|
||||||
RGBA{0x44, 0x44, 0x44, 0xff},
|
|
||||||
RGBA{0x44, 0x44, 0x88, 0xff},
|
|
||||||
RGBA{0x44, 0x44, 0xcc, 0xff},
|
|
||||||
RGBA{0x44, 0x88, 0x00, 0xff},
|
|
||||||
RGBA{0x44, 0x88, 0x44, 0xff},
|
|
||||||
RGBA{0x44, 0x88, 0x88, 0xff},
|
|
||||||
RGBA{0x44, 0x88, 0xcc, 0xff},
|
|
||||||
RGBA{0x44, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x44, 0xcc, 0x44, 0xff},
|
|
||||||
RGBA{0x44, 0xcc, 0x88, 0xff},
|
|
||||||
RGBA{0x44, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x44, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x55, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x55, 0x00, 0x55, 0xff},
|
|
||||||
RGBA{0x4c, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x49, 0x00, 0xdd, 0xff},
|
|
||||||
RGBA{0x55, 0x55, 0x00, 0xff},
|
|
||||||
RGBA{0x55, 0x55, 0x55, 0xff},
|
|
||||||
RGBA{0x4c, 0x4c, 0x99, 0xff},
|
|
||||||
RGBA{0x49, 0x49, 0xdd, 0xff},
|
|
||||||
RGBA{0x4c, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x4c, 0x99, 0x4c, 0xff},
|
|
||||||
RGBA{0x4c, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x49, 0x93, 0xdd, 0xff},
|
|
||||||
RGBA{0x49, 0xdd, 0x00, 0xff},
|
|
||||||
RGBA{0x49, 0xdd, 0x49, 0xff},
|
|
||||||
RGBA{0x49, 0xdd, 0x93, 0xff},
|
|
||||||
RGBA{0x49, 0xdd, 0xdd, 0xff},
|
|
||||||
RGBA{0x4f, 0xee, 0xee, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x55, 0x00, 0xaa, 0xff},
|
|
||||||
RGBA{0x4f, 0x00, 0xee, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x55, 0x55, 0xaa, 0xff},
|
|
||||||
RGBA{0x4f, 0x4f, 0xee, 0xff},
|
|
||||||
RGBA{0x55, 0xaa, 0x00, 0xff},
|
|
||||||
RGBA{0x55, 0xaa, 0x55, 0xff},
|
|
||||||
RGBA{0x55, 0xaa, 0xaa, 0xff},
|
|
||||||
RGBA{0x4f, 0x9e, 0xee, 0xff},
|
|
||||||
RGBA{0x4f, 0xee, 0x00, 0xff},
|
|
||||||
RGBA{0x4f, 0xee, 0x4f, 0xff},
|
|
||||||
RGBA{0x4f, 0xee, 0x9e, 0xff},
|
|
||||||
RGBA{0x55, 0xff, 0xaa, 0xff},
|
|
||||||
RGBA{0x55, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0x77, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x77, 0x00, 0x77, 0xff},
|
|
||||||
RGBA{0x5d, 0x00, 0xbb, 0xff},
|
|
||||||
RGBA{0x55, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x77, 0x77, 0x00, 0xff},
|
|
||||||
RGBA{0x77, 0x77, 0x77, 0xff},
|
|
||||||
RGBA{0x5d, 0x5d, 0xbb, 0xff},
|
|
||||||
RGBA{0x55, 0x55, 0xff, 0xff},
|
|
||||||
RGBA{0x5d, 0xbb, 0x00, 0xff},
|
|
||||||
RGBA{0x5d, 0xbb, 0x5d, 0xff},
|
|
||||||
RGBA{0x5d, 0xbb, 0xbb, 0xff},
|
|
||||||
RGBA{0x55, 0xaa, 0xff, 0xff},
|
|
||||||
RGBA{0x55, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x55, 0xff, 0x55, 0xff},
|
|
||||||
RGBA{0x88, 0x00, 0x88, 0xff},
|
|
||||||
RGBA{0x88, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x88, 0x44, 0x00, 0xff},
|
|
||||||
RGBA{0x88, 0x44, 0x44, 0xff},
|
|
||||||
RGBA{0x88, 0x44, 0x88, 0xff},
|
|
||||||
RGBA{0x88, 0x44, 0xcc, 0xff},
|
|
||||||
RGBA{0x88, 0x88, 0x00, 0xff},
|
|
||||||
RGBA{0x88, 0x88, 0x44, 0xff},
|
|
||||||
RGBA{0x88, 0x88, 0x88, 0xff},
|
|
||||||
RGBA{0x88, 0x88, 0xcc, 0xff},
|
|
||||||
RGBA{0x88, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x88, 0xcc, 0x44, 0xff},
|
|
||||||
RGBA{0x88, 0xcc, 0x88, 0xff},
|
|
||||||
RGBA{0x88, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x88, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x88, 0x00, 0x44, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x4c, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x93, 0x00, 0xdd, 0xff},
|
|
||||||
RGBA{0x99, 0x4c, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x4c, 0x4c, 0xff},
|
|
||||||
RGBA{0x99, 0x4c, 0x99, 0xff},
|
|
||||||
RGBA{0x93, 0x49, 0xdd, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x4c, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x93, 0x93, 0xdd, 0xff},
|
|
||||||
RGBA{0x93, 0xdd, 0x00, 0xff},
|
|
||||||
RGBA{0x93, 0xdd, 0x49, 0xff},
|
|
||||||
RGBA{0x93, 0xdd, 0x93, 0xff},
|
|
||||||
RGBA{0x93, 0xdd, 0xdd, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xaa, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xaa, 0x00, 0x55, 0xff},
|
|
||||||
RGBA{0xaa, 0x00, 0xaa, 0xff},
|
|
||||||
RGBA{0x9e, 0x00, 0xee, 0xff},
|
|
||||||
RGBA{0xaa, 0x55, 0x00, 0xff},
|
|
||||||
RGBA{0xaa, 0x55, 0x55, 0xff},
|
|
||||||
RGBA{0xaa, 0x55, 0xaa, 0xff},
|
|
||||||
RGBA{0x9e, 0x4f, 0xee, 0xff},
|
|
||||||
RGBA{0xaa, 0xaa, 0x00, 0xff},
|
|
||||||
RGBA{0xaa, 0xaa, 0x55, 0xff},
|
|
||||||
RGBA{0xaa, 0xaa, 0xaa, 0xff},
|
|
||||||
RGBA{0x9e, 0x9e, 0xee, 0xff},
|
|
||||||
RGBA{0x9e, 0xee, 0x00, 0xff},
|
|
||||||
RGBA{0x9e, 0xee, 0x4f, 0xff},
|
|
||||||
RGBA{0x9e, 0xee, 0x9e, 0xff},
|
|
||||||
RGBA{0x9e, 0xee, 0xee, 0xff},
|
|
||||||
RGBA{0xaa, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0xbb, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xbb, 0x00, 0x5d, 0xff},
|
|
||||||
RGBA{0xbb, 0x00, 0xbb, 0xff},
|
|
||||||
RGBA{0xaa, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0xbb, 0x5d, 0x00, 0xff},
|
|
||||||
RGBA{0xbb, 0x5d, 0x5d, 0xff},
|
|
||||||
RGBA{0xbb, 0x5d, 0xbb, 0xff},
|
|
||||||
RGBA{0xaa, 0x55, 0xff, 0xff},
|
|
||||||
RGBA{0xbb, 0xbb, 0x00, 0xff},
|
|
||||||
RGBA{0xbb, 0xbb, 0x5d, 0xff},
|
|
||||||
RGBA{0xbb, 0xbb, 0xbb, 0xff},
|
|
||||||
RGBA{0xaa, 0xaa, 0xff, 0xff},
|
|
||||||
RGBA{0xaa, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0xaa, 0xff, 0x55, 0xff},
|
|
||||||
RGBA{0xaa, 0xff, 0xaa, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x44, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x44, 0x44, 0xff},
|
|
||||||
RGBA{0xcc, 0x44, 0x88, 0xff},
|
|
||||||
RGBA{0xcc, 0x44, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x88, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x88, 0x44, 0xff},
|
|
||||||
RGBA{0xcc, 0x88, 0x88, 0xff},
|
|
||||||
RGBA{0xcc, 0x88, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x44, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x88, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x44, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x88, 0xff},
|
|
||||||
RGBA{0xdd, 0x00, 0x93, 0xff},
|
|
||||||
RGBA{0xdd, 0x00, 0xdd, 0xff},
|
|
||||||
RGBA{0xdd, 0x49, 0x00, 0xff},
|
|
||||||
RGBA{0xdd, 0x49, 0x49, 0xff},
|
|
||||||
RGBA{0xdd, 0x49, 0x93, 0xff},
|
|
||||||
RGBA{0xdd, 0x49, 0xdd, 0xff},
|
|
||||||
RGBA{0xdd, 0x93, 0x00, 0xff},
|
|
||||||
RGBA{0xdd, 0x93, 0x49, 0xff},
|
|
||||||
RGBA{0xdd, 0x93, 0x93, 0xff},
|
|
||||||
RGBA{0xdd, 0x93, 0xdd, 0xff},
|
|
||||||
RGBA{0xdd, 0xdd, 0x00, 0xff},
|
|
||||||
RGBA{0xdd, 0xdd, 0x49, 0xff},
|
|
||||||
RGBA{0xdd, 0xdd, 0x93, 0xff},
|
|
||||||
RGBA{0xdd, 0xdd, 0xdd, 0xff},
|
|
||||||
RGBA{0xdd, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xdd, 0x00, 0x49, 0xff},
|
|
||||||
RGBA{0xee, 0x00, 0x4f, 0xff},
|
|
||||||
RGBA{0xee, 0x00, 0x9e, 0xff},
|
|
||||||
RGBA{0xee, 0x00, 0xee, 0xff},
|
|
||||||
RGBA{0xee, 0x4f, 0x00, 0xff},
|
|
||||||
RGBA{0xee, 0x4f, 0x4f, 0xff},
|
|
||||||
RGBA{0xee, 0x4f, 0x9e, 0xff},
|
|
||||||
RGBA{0xee, 0x4f, 0xee, 0xff},
|
|
||||||
RGBA{0xee, 0x9e, 0x00, 0xff},
|
|
||||||
RGBA{0xee, 0x9e, 0x4f, 0xff},
|
|
||||||
RGBA{0xee, 0x9e, 0x9e, 0xff},
|
|
||||||
RGBA{0xee, 0x9e, 0xee, 0xff},
|
|
||||||
RGBA{0xee, 0xee, 0x00, 0xff},
|
|
||||||
RGBA{0xee, 0xee, 0x4f, 0xff},
|
|
||||||
RGBA{0xee, 0xee, 0x9e, 0xff},
|
|
||||||
RGBA{0xee, 0xee, 0xee, 0xff},
|
|
||||||
RGBA{0xee, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x55, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0xaa, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0x55, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x55, 0x55, 0xff},
|
|
||||||
RGBA{0xff, 0x55, 0xaa, 0xff},
|
|
||||||
RGBA{0xff, 0x55, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0xaa, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0xaa, 0x55, 0xff},
|
|
||||||
RGBA{0xff, 0xaa, 0xaa, 0xff},
|
|
||||||
RGBA{0xff, 0xaa, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x55, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0xaa, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0xff, 0xff},
|
|
||||||
}
|
|
||||||
|
|
||||||
// WebSafePalette is a 216-color palette that was popularized by early versions
|
|
||||||
// of Netscape Navigator. It is also known as the Netscape Color Cube.
|
|
||||||
//
|
|
||||||
// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.
|
|
||||||
var WebSafePalette = []Color{
|
|
||||||
RGBA{0x00, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0x00, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0x33, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0x66, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0x99, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0xcc, 0xff, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0x00, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0x33, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0x66, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0x99, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0xcc, 0xff, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x00, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x33, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x66, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0x99, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0xcc, 0xff},
|
|
||||||
RGBA{0xff, 0xff, 0xff, 0xff},
|
|
||||||
}
|
|
@ -16,7 +16,10 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
fmt.Println("// generated by go run gen.go; DO NOT EDIT")
|
fmt.Println("// generated by go run gen.go; DO NOT EDIT")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
fmt.Println("package color")
|
fmt.Println("// Package palette provides standard color palettes.")
|
||||||
|
fmt.Println("package palette")
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Println(`import "image/color"`)
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
printPlan9()
|
printPlan9()
|
||||||
printWebSafe()
|
printWebSafe()
|
||||||
@ -46,14 +49,14 @@ func printPlan9() {
|
|||||||
c[2] = b * num / den
|
c[2] = b * num / den
|
||||||
}
|
}
|
||||||
lines[i+(j&0x0f)] =
|
lines[i+(j&0x0f)] =
|
||||||
fmt.Sprintf("\tRGBA{0x%02x, 0x%02x, 0x%02x, 0xff},", c[0], c[1], c[2])
|
fmt.Sprintf("\tcolor.RGBA{0x%02x, 0x%02x, 0x%02x, 0xff},", c[0], c[1], c[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("// Plan9Palette is a 256-color palette that partitions the 24-bit RGB space")
|
fmt.Println("// Plan9 is a 256-color palette that partitions the 24-bit RGB space")
|
||||||
fmt.Println("// into 4×4×4 subdivision, with 4 shades in each subcube. Compared to the")
|
fmt.Println("// into 4×4×4 subdivision, with 4 shades in each subcube. Compared to the")
|
||||||
fmt.Println("// WebSafePalette, the idea is to reduce the color resolution by dicing the")
|
fmt.Println("// WebSafe, the idea is to reduce the color resolution by dicing the")
|
||||||
fmt.Println("// color cube into fewer cells, and to use the extra space to increase the")
|
fmt.Println("// color cube into fewer cells, and to use the extra space to increase the")
|
||||||
fmt.Println("// intensity resolution. This results in 16 gray shades (4 gray subcubes with")
|
fmt.Println("// intensity resolution. This results in 16 gray shades (4 gray subcubes with")
|
||||||
fmt.Println("// 4 samples in each), 13 shades of each primary and secondary color (3")
|
fmt.Println("// 4 samples in each), 13 shades of each primary and secondary color (3")
|
||||||
@ -63,7 +66,7 @@ func printPlan9() {
|
|||||||
fmt.Println("//")
|
fmt.Println("//")
|
||||||
fmt.Println("// This palette was used in the Plan 9 Operating System, described at")
|
fmt.Println("// This palette was used in the Plan 9 Operating System, described at")
|
||||||
fmt.Println("// http://plan9.bell-labs.com/magic/man2html/6/color")
|
fmt.Println("// http://plan9.bell-labs.com/magic/man2html/6/color")
|
||||||
fmt.Println("var Plan9Palette = []Color{")
|
fmt.Println("var Plan9 = []color.Color{")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
fmt.Println(line)
|
fmt.Println(line)
|
||||||
}
|
}
|
||||||
@ -77,15 +80,15 @@ func printWebSafe() {
|
|||||||
for g := 0; g < 6; g++ {
|
for g := 0; g < 6; g++ {
|
||||||
for b := 0; b < 6; b++ {
|
for b := 0; b < 6; b++ {
|
||||||
lines[36*r+6*g+b] =
|
lines[36*r+6*g+b] =
|
||||||
fmt.Sprintf("\tRGBA{0x%02x, 0x%02x, 0x%02x, 0xff},", 0x33*r, 0x33*g, 0x33*b)
|
fmt.Sprintf("\tcolor.RGBA{0x%02x, 0x%02x, 0x%02x, 0xff},", 0x33*r, 0x33*g, 0x33*b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("// WebSafePalette is a 216-color palette that was popularized by early versions")
|
fmt.Println("// WebSafe is a 216-color palette that was popularized by early versions")
|
||||||
fmt.Println("// of Netscape Navigator. It is also known as the Netscape Color Cube.")
|
fmt.Println("// of Netscape Navigator. It is also known as the Netscape Color Cube.")
|
||||||
fmt.Println("//")
|
fmt.Println("//")
|
||||||
fmt.Println("// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.")
|
fmt.Println("// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.")
|
||||||
fmt.Println("var WebSafePalette = []Color{")
|
fmt.Println("var WebSafe = []color.Color{")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
fmt.Println(line)
|
fmt.Println(line)
|
||||||
}
|
}
|
500
src/pkg/image/color/palette/palette.go
Normal file
500
src/pkg/image/color/palette/palette.go
Normal file
@ -0,0 +1,500 @@
|
|||||||
|
// generated by go run gen.go; DO NOT EDIT
|
||||||
|
|
||||||
|
// Package palette provides standard color palettes.
|
||||||
|
package palette
|
||||||
|
|
||||||
|
import "image/color"
|
||||||
|
|
||||||
|
// Plan9 is a 256-color palette that partitions the 24-bit RGB space
|
||||||
|
// into 4×4×4 subdivision, with 4 shades in each subcube. Compared to the
|
||||||
|
// WebSafe, the idea is to reduce the color resolution by dicing the
|
||||||
|
// color cube into fewer cells, and to use the extra space to increase the
|
||||||
|
// intensity resolution. This results in 16 gray shades (4 gray subcubes with
|
||||||
|
// 4 samples in each), 13 shades of each primary and secondary color (3
|
||||||
|
// subcubes with 4 samples plus black) and a reasonable selection of colors
|
||||||
|
// covering the rest of the color cube. The advantage is better representation
|
||||||
|
// of continuous tones.
|
||||||
|
//
|
||||||
|
// This palette was used in the Plan 9 Operating System, described at
|
||||||
|
// http://plan9.bell-labs.com/magic/man2html/6/color
|
||||||
|
var Plan9 = []color.Color{
|
||||||
|
color.RGBA{0x00, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x44, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x88, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x44, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x44, 0x44, 0xff},
|
||||||
|
color.RGBA{0x00, 0x44, 0x88, 0xff},
|
||||||
|
color.RGBA{0x00, 0x44, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x88, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x88, 0x44, 0xff},
|
||||||
|
color.RGBA{0x00, 0x88, 0x88, 0xff},
|
||||||
|
color.RGBA{0x00, 0x88, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x44, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x88, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0xdd, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x11, 0x11, 0x11, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x55, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x00, 0x55, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x55, 0x55, 0xff},
|
||||||
|
color.RGBA{0x00, 0x4c, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x49, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x4c, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x93, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x00, 0xdd, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xdd, 0x49, 0xff},
|
||||||
|
color.RGBA{0x00, 0xdd, 0x93, 0xff},
|
||||||
|
color.RGBA{0x00, 0xee, 0x9e, 0xff},
|
||||||
|
color.RGBA{0x00, 0xee, 0xee, 0xff},
|
||||||
|
color.RGBA{0x22, 0x22, 0x22, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xee, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x55, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x00, 0x4f, 0xee, 0xff},
|
||||||
|
color.RGBA{0x00, 0xaa, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xaa, 0x55, 0xff},
|
||||||
|
color.RGBA{0x00, 0xaa, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x00, 0x9e, 0xee, 0xff},
|
||||||
|
color.RGBA{0x00, 0xee, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xee, 0x4f, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x55, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x77, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0x77, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x77, 0x77, 0xff},
|
||||||
|
color.RGBA{0x00, 0x5d, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x00, 0x55, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0xbb, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xbb, 0x5d, 0xff},
|
||||||
|
color.RGBA{0x00, 0xbb, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x00, 0xaa, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x44, 0x00, 0x44, 0xff},
|
||||||
|
color.RGBA{0x44, 0x00, 0x88, 0xff},
|
||||||
|
color.RGBA{0x44, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x44, 0x44, 0x00, 0xff},
|
||||||
|
color.RGBA{0x44, 0x44, 0x44, 0xff},
|
||||||
|
color.RGBA{0x44, 0x44, 0x88, 0xff},
|
||||||
|
color.RGBA{0x44, 0x44, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x44, 0x88, 0x00, 0xff},
|
||||||
|
color.RGBA{0x44, 0x88, 0x44, 0xff},
|
||||||
|
color.RGBA{0x44, 0x88, 0x88, 0xff},
|
||||||
|
color.RGBA{0x44, 0x88, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x44, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x44, 0xcc, 0x44, 0xff},
|
||||||
|
color.RGBA{0x44, 0xcc, 0x88, 0xff},
|
||||||
|
color.RGBA{0x44, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x44, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x55, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x55, 0x00, 0x55, 0xff},
|
||||||
|
color.RGBA{0x4c, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x49, 0x00, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x55, 0x55, 0x00, 0xff},
|
||||||
|
color.RGBA{0x55, 0x55, 0x55, 0xff},
|
||||||
|
color.RGBA{0x4c, 0x4c, 0x99, 0xff},
|
||||||
|
color.RGBA{0x49, 0x49, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x4c, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x4c, 0x99, 0x4c, 0xff},
|
||||||
|
color.RGBA{0x4c, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x49, 0x93, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x49, 0xdd, 0x00, 0xff},
|
||||||
|
color.RGBA{0x49, 0xdd, 0x49, 0xff},
|
||||||
|
color.RGBA{0x49, 0xdd, 0x93, 0xff},
|
||||||
|
color.RGBA{0x49, 0xdd, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x4f, 0xee, 0xee, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x55, 0x00, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x4f, 0x00, 0xee, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x55, 0x55, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x4f, 0x4f, 0xee, 0xff},
|
||||||
|
color.RGBA{0x55, 0xaa, 0x00, 0xff},
|
||||||
|
color.RGBA{0x55, 0xaa, 0x55, 0xff},
|
||||||
|
color.RGBA{0x55, 0xaa, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x4f, 0x9e, 0xee, 0xff},
|
||||||
|
color.RGBA{0x4f, 0xee, 0x00, 0xff},
|
||||||
|
color.RGBA{0x4f, 0xee, 0x4f, 0xff},
|
||||||
|
color.RGBA{0x4f, 0xee, 0x9e, 0xff},
|
||||||
|
color.RGBA{0x55, 0xff, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x55, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0x77, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x77, 0x00, 0x77, 0xff},
|
||||||
|
color.RGBA{0x5d, 0x00, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x55, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x77, 0x77, 0x00, 0xff},
|
||||||
|
color.RGBA{0x77, 0x77, 0x77, 0xff},
|
||||||
|
color.RGBA{0x5d, 0x5d, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x55, 0x55, 0xff, 0xff},
|
||||||
|
color.RGBA{0x5d, 0xbb, 0x00, 0xff},
|
||||||
|
color.RGBA{0x5d, 0xbb, 0x5d, 0xff},
|
||||||
|
color.RGBA{0x5d, 0xbb, 0xbb, 0xff},
|
||||||
|
color.RGBA{0x55, 0xaa, 0xff, 0xff},
|
||||||
|
color.RGBA{0x55, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x55, 0xff, 0x55, 0xff},
|
||||||
|
color.RGBA{0x88, 0x00, 0x88, 0xff},
|
||||||
|
color.RGBA{0x88, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x88, 0x44, 0x00, 0xff},
|
||||||
|
color.RGBA{0x88, 0x44, 0x44, 0xff},
|
||||||
|
color.RGBA{0x88, 0x44, 0x88, 0xff},
|
||||||
|
color.RGBA{0x88, 0x44, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x88, 0x88, 0x00, 0xff},
|
||||||
|
color.RGBA{0x88, 0x88, 0x44, 0xff},
|
||||||
|
color.RGBA{0x88, 0x88, 0x88, 0xff},
|
||||||
|
color.RGBA{0x88, 0x88, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x88, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x88, 0xcc, 0x44, 0xff},
|
||||||
|
color.RGBA{0x88, 0xcc, 0x88, 0xff},
|
||||||
|
color.RGBA{0x88, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x88, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x88, 0x00, 0x44, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x4c, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x93, 0x00, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x99, 0x4c, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x4c, 0x4c, 0xff},
|
||||||
|
color.RGBA{0x99, 0x4c, 0x99, 0xff},
|
||||||
|
color.RGBA{0x93, 0x49, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x4c, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x93, 0x93, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x93, 0xdd, 0x00, 0xff},
|
||||||
|
color.RGBA{0x93, 0xdd, 0x49, 0xff},
|
||||||
|
color.RGBA{0x93, 0xdd, 0x93, 0xff},
|
||||||
|
color.RGBA{0x93, 0xdd, 0xdd, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x00, 0x55, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x00, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x9e, 0x00, 0xee, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x55, 0x00, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x55, 0x55, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x55, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x9e, 0x4f, 0xee, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xaa, 0x00, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xaa, 0x55, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xaa, 0xaa, 0xff},
|
||||||
|
color.RGBA{0x9e, 0x9e, 0xee, 0xff},
|
||||||
|
color.RGBA{0x9e, 0xee, 0x00, 0xff},
|
||||||
|
color.RGBA{0x9e, 0xee, 0x4f, 0xff},
|
||||||
|
color.RGBA{0x9e, 0xee, 0x9e, 0xff},
|
||||||
|
color.RGBA{0x9e, 0xee, 0xee, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x00, 0x5d, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x00, 0xbb, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x5d, 0x00, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x5d, 0x5d, 0xff},
|
||||||
|
color.RGBA{0xbb, 0x5d, 0xbb, 0xff},
|
||||||
|
color.RGBA{0xaa, 0x55, 0xff, 0xff},
|
||||||
|
color.RGBA{0xbb, 0xbb, 0x00, 0xff},
|
||||||
|
color.RGBA{0xbb, 0xbb, 0x5d, 0xff},
|
||||||
|
color.RGBA{0xbb, 0xbb, 0xbb, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xaa, 0xff, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xff, 0x55, 0xff},
|
||||||
|
color.RGBA{0xaa, 0xff, 0xaa, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x44, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x44, 0x44, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x44, 0x88, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x44, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x88, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x88, 0x44, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x88, 0x88, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x88, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x44, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x88, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x44, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x88, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x00, 0x93, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x00, 0xdd, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x49, 0x00, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x49, 0x49, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x49, 0x93, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x49, 0xdd, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x93, 0x00, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x93, 0x49, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x93, 0x93, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x93, 0xdd, 0xff},
|
||||||
|
color.RGBA{0xdd, 0xdd, 0x00, 0xff},
|
||||||
|
color.RGBA{0xdd, 0xdd, 0x49, 0xff},
|
||||||
|
color.RGBA{0xdd, 0xdd, 0x93, 0xff},
|
||||||
|
color.RGBA{0xdd, 0xdd, 0xdd, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xdd, 0x00, 0x49, 0xff},
|
||||||
|
color.RGBA{0xee, 0x00, 0x4f, 0xff},
|
||||||
|
color.RGBA{0xee, 0x00, 0x9e, 0xff},
|
||||||
|
color.RGBA{0xee, 0x00, 0xee, 0xff},
|
||||||
|
color.RGBA{0xee, 0x4f, 0x00, 0xff},
|
||||||
|
color.RGBA{0xee, 0x4f, 0x4f, 0xff},
|
||||||
|
color.RGBA{0xee, 0x4f, 0x9e, 0xff},
|
||||||
|
color.RGBA{0xee, 0x4f, 0xee, 0xff},
|
||||||
|
color.RGBA{0xee, 0x9e, 0x00, 0xff},
|
||||||
|
color.RGBA{0xee, 0x9e, 0x4f, 0xff},
|
||||||
|
color.RGBA{0xee, 0x9e, 0x9e, 0xff},
|
||||||
|
color.RGBA{0xee, 0x9e, 0xee, 0xff},
|
||||||
|
color.RGBA{0xee, 0xee, 0x00, 0xff},
|
||||||
|
color.RGBA{0xee, 0xee, 0x4f, 0xff},
|
||||||
|
color.RGBA{0xee, 0xee, 0x9e, 0xff},
|
||||||
|
color.RGBA{0xee, 0xee, 0xee, 0xff},
|
||||||
|
color.RGBA{0xee, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x55, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0xaa, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0x55, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x55, 0x55, 0xff},
|
||||||
|
color.RGBA{0xff, 0x55, 0xaa, 0xff},
|
||||||
|
color.RGBA{0xff, 0x55, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0xaa, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0xaa, 0x55, 0xff},
|
||||||
|
color.RGBA{0xff, 0xaa, 0xaa, 0xff},
|
||||||
|
color.RGBA{0xff, 0xaa, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x55, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0xaa, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0xff, 0xff},
|
||||||
|
}
|
||||||
|
|
||||||
|
// WebSafe is a 216-color palette that was popularized by early versions
|
||||||
|
// of Netscape Navigator. It is also known as the Netscape Color Cube.
|
||||||
|
//
|
||||||
|
// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.
|
||||||
|
var WebSafe = []color.Color{
|
||||||
|
color.RGBA{0x00, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x00, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x33, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x66, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0x99, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xcc, 0xff, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0x00, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0x33, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0x66, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0x99, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0xcc, 0xff, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x00, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x33, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x66, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0x99, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0xcc, 0xff},
|
||||||
|
color.RGBA{0xff, 0xff, 0xff, 0xff},
|
||||||
|
}
|
@ -11,11 +11,11 @@ import (
|
|||||||
|
|
||||||
// header, palette and trailer are parts of a valid 2x1 GIF image.
|
// header, palette and trailer are parts of a valid 2x1 GIF image.
|
||||||
const (
|
const (
|
||||||
header = "GIF89a" +
|
headerStr = "GIF89a" +
|
||||||
"\x02\x00\x01\x00" + // width=2, height=1
|
"\x02\x00\x01\x00" + // width=2, height=1
|
||||||
"\x80\x00\x00" // headerFields=(a color map of 2 pixels), backgroundIndex, aspect
|
"\x80\x00\x00" // headerFields=(a color map of 2 pixels), backgroundIndex, aspect
|
||||||
palette = "\x10\x20\x30\x40\x50\x60" // the color map, also known as a palette
|
paletteStr = "\x10\x20\x30\x40\x50\x60" // the color map, also known as a palette
|
||||||
trailer = "\x3b"
|
trailerStr = "\x3b"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDecode(t *testing.T) {
|
func TestDecode(t *testing.T) {
|
||||||
@ -41,8 +41,8 @@ func TestDecode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
b.WriteString(header)
|
b.WriteString(headerStr)
|
||||||
b.WriteString(palette)
|
b.WriteString(paletteStr)
|
||||||
// Write an image with bounds 2x1 but tc.nPix pixels. If tc.nPix != 2
|
// Write an image with bounds 2x1 but tc.nPix pixels. If tc.nPix != 2
|
||||||
// then this should result in an invalid GIF image. First, write a
|
// then this should result in an invalid GIF image. First, write a
|
||||||
// magic 0x2c (image descriptor) byte, bounds=(0,0)-(2,1), a flags
|
// magic 0x2c (image descriptor) byte, bounds=(0,0)-(2,1), a flags
|
||||||
@ -61,7 +61,7 @@ func TestDecode(t *testing.T) {
|
|||||||
b.WriteString("\x01\x02") // A 1-byte payload with an 0x02 byte.
|
b.WriteString("\x01\x02") // A 1-byte payload with an 0x02 byte.
|
||||||
}
|
}
|
||||||
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
||||||
b.WriteString(trailer)
|
b.WriteString(trailerStr)
|
||||||
|
|
||||||
got, err := Decode(b)
|
got, err := Decode(b)
|
||||||
if err != tc.wantErr {
|
if err != tc.wantErr {
|
||||||
@ -143,7 +143,7 @@ func TestNoPalette(t *testing.T) {
|
|||||||
|
|
||||||
// Manufacture a GIF with no palette, so any pixel at all
|
// Manufacture a GIF with no palette, so any pixel at all
|
||||||
// will be invalid.
|
// will be invalid.
|
||||||
b.WriteString(header[:len(header)-3])
|
b.WriteString(headerStr[:len(headerStr)-3])
|
||||||
b.WriteString("\x00\x00\x00") // No global palette.
|
b.WriteString("\x00\x00\x00") // No global palette.
|
||||||
|
|
||||||
// Image descriptor: 2x1, no local palette.
|
// Image descriptor: 2x1, no local palette.
|
||||||
@ -159,7 +159,7 @@ func TestNoPalette(t *testing.T) {
|
|||||||
b.Write(enc.Bytes())
|
b.Write(enc.Bytes())
|
||||||
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
||||||
|
|
||||||
b.WriteString(trailer)
|
b.WriteString(trailerStr)
|
||||||
|
|
||||||
try(t, b.Bytes(), "gif: invalid pixel value")
|
try(t, b.Bytes(), "gif: invalid pixel value")
|
||||||
}
|
}
|
||||||
@ -169,8 +169,8 @@ func TestPixelOutsidePaletteRange(t *testing.T) {
|
|||||||
b := &bytes.Buffer{}
|
b := &bytes.Buffer{}
|
||||||
|
|
||||||
// Manufacture a GIF with a 2 color palette.
|
// Manufacture a GIF with a 2 color palette.
|
||||||
b.WriteString(header)
|
b.WriteString(headerStr)
|
||||||
b.WriteString(palette)
|
b.WriteString(paletteStr)
|
||||||
|
|
||||||
// Image descriptor: 2x1, no local palette.
|
// Image descriptor: 2x1, no local palette.
|
||||||
b.WriteString("\x2c\x00\x00\x00\x00\x02\x00\x01\x00\x00\x02")
|
b.WriteString("\x2c\x00\x00\x00\x00\x02\x00\x01\x00\x00\x02")
|
||||||
@ -185,7 +185,7 @@ func TestPixelOutsidePaletteRange(t *testing.T) {
|
|||||||
b.Write(enc.Bytes())
|
b.Write(enc.Bytes())
|
||||||
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
b.WriteByte(0x00) // An empty block signifies the end of the image data.
|
||||||
|
|
||||||
b.WriteString(trailer)
|
b.WriteString(trailerStr)
|
||||||
|
|
||||||
// No error expected, unless the pixels are beyond the 2 color palette.
|
// No error expected, unless the pixels are beyond the 2 color palette.
|
||||||
want := ""
|
want := ""
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"image/color/palette"
|
||||||
"image/draw"
|
"image/draw"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
@ -248,7 +249,7 @@ type Options struct {
|
|||||||
NumColors int
|
NumColors int
|
||||||
|
|
||||||
// Quantizer is used to produce a palette with size NumColors.
|
// Quantizer is used to produce a palette with size NumColors.
|
||||||
// color.Plan9Palette is used in place of a nil Quantizer.
|
// palette.Plan9 is used in place of a nil Quantizer.
|
||||||
Quantizer draw.Quantizer
|
Quantizer draw.Quantizer
|
||||||
|
|
||||||
// Drawer is used to convert the source image to the desired palette.
|
// Drawer is used to convert the source image to the desired palette.
|
||||||
@ -308,7 +309,7 @@ func Encode(w io.Writer, m image.Image, o *Options) error {
|
|||||||
pm, ok := m.(*image.Paletted)
|
pm, ok := m.(*image.Paletted)
|
||||||
if !ok || len(pm.Palette) > opts.NumColors {
|
if !ok || len(pm.Palette) > opts.NumColors {
|
||||||
// TODO: Pick a better sub-sample of the Plan 9 palette.
|
// TODO: Pick a better sub-sample of the Plan 9 palette.
|
||||||
pm = image.NewPaletted(b, color.Plan9Palette[:opts.NumColors])
|
pm = image.NewPaletted(b, palette.Plan9[:opts.NumColors])
|
||||||
if opts.Quantizer != nil {
|
if opts.Quantizer != nil {
|
||||||
pm.Palette = opts.Quantizer.Quantize(make(color.Palette, 0, opts.NumColors), m)
|
pm.Palette = opts.Quantizer.Quantize(make(color.Palette, 0, opts.NumColors), m)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user