Static
ofReadonly
primaryThe primary color or a transparency (denoted by null
).
Readonly
secondaryThe secondary color or a transparency (denoted by null
).
Readonly
typeA property helpful for TypeScript type inference, when distinguishing from other types of colors.
const c:
| null
| BpxRgbColor
| BpxPatternColors
| BpxSpriteColorMapping
| BpxCanvasSnapshotColorMapping
= getColor();
if (c == null) {
// c is transparent here
} else if (c.type === "rgb") {
// c is BpxRgbColor here
} else if (c.type === "pattern") {
// c is BpxPatternColors here
} else if (c.type === "sprite_mapping") {
// c is BpxSpriteColorMapping here
} else if (c.type === "canvas_snapshot_mapping") {
// c is BpxCanvasSnapshotColorMapping here
} else {
$u.assertUnreachable(c);
}
A set of two colors, used in combination with BpxDrawingPattern, where given pixels are colored with either the
primary
or thesecondary
.