Go image/color: color models and values
Answer: Package color implements a basic color library.
The Color interface
A Color value can convert itself to alpha-premultiplied 16-bit channels as RGBA.
That conversion may be lossy.
Ready-made types include RGBA, NRGBA, Alpha, Gray, Gray16, and CMYK.
Models and palettes
A Model can convert any Color into one from its own color model.
NYCbCrA and NRGBA are types in the package.
A Palette can Convert a Color.
See also
Claims
- id: C1 claim: Package color implements a basic color library. source: S2 evidence: "Package color implements a basic color library."
- id: C2 claim: A Color can convert itself to alpha-premultiplied 16-bit-per-channel RGBA. source: S2 evidence: "Color can convert itself to alpha-premultiplied 16-bits per channel RGBA."
- id: C3 claim: The conversion may be lossy. source: S2 evidence: "The conversion may be lossy."
- id: C4 claim: ModelFunc builds a Model from a function. source: S1 evidence: "func ModelFunc(f func(Color) Color) Model"
Sources
- [S1] image/color. The Go Authors. https://pkg.go.dev/image/color . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] image/color source. The Go Authors. https://go.dev/src/image/color/color.go . License: BSD-3-Clause. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, image/color; The Go Authors, image/color source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, image/color; The Go Authors, image/color source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go image/color: color models and values." iinventedlight Library, iil:note:xdcqs5yb, version of 2026-11-24. https://iinventedlight.com/library/notes/go-color/. License: CC-BY-4.0.
@misc{iil_note_xdcqs5yb,
author = {{iinventedlight}},
title = {{Go image/color: color models and values}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/go-color/},
note = {Permanent ID iil:note:xdcqs5yb. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-color.schema.json (schema; CC-BY-4.0)
- go-color.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-color.md.