Class ColorNaming
- Namespace
- LMKit.Graphics.Primitives
- Assembly
- LM-Kit.NET.dll
Names a color with the basic color term (BasicColorTerm) a person would use for it: "blue" for a navy and a sky alike, "brown" for a tan and a chocolate. The vocabulary a color search facet, a caption or an accessibility description can rely on.
public static class ColorNaming
- Inheritance
-
ColorNaming
- Inherited Members
Remarks
The decision is made in CIELAB. Two explicit rules settle the achromatic terms first - a very light, nearly neutral color is white, a very dark one is black, a low-chroma midtone is gray - because those judgments depend on lightness and chroma alone and a nearest-neighbor vote would let a faint tint pull an off-white into pink or a charcoal into blue. Every other color takes the term of its nearest prototype under the CIEDE2000 difference (DeltaE2000(LabColor, LabColor)), the prototypes being well-known named colors chosen to cover each term's light, dark and muted members (a navy and a sky for blue, a tan and a chocolate for brown). Prototype classification in a perceptually uniform space is the standard baseline of the color-naming literature and is deterministic, explainable and fast (a few dozen distance evaluations).
Boundary colors (a red-orange, a blue-violet) can legitimately be called either way; the method answers one term consistently rather than refusing.
Methods
- Name(Color32)
Names an 8-bit sRGB color. Alpha is ignored.
- Name(LabColor)
Names a CIELAB color.
- ToToken(BasicColorTerm)
The lowercase English word for a term ("red", "light gray" is never produced: one word per term), suitable as a stable wire or index token.
- TryParse(string, out BasicColorTerm)
Parses a token produced by ToToken(BasicColorTerm) (case-insensitive; "grey" is accepted for gray). Returns false for anything else.