Palette

class Palette(val slots: Int)(source)

How many colours the caller paints, and which of them a thing is drawn on.

The colours themselves live with the rest of the design — a theme, a colour resource file, a stylesheet — and this type only says which of them to reach for.

A count below 1 means the code and the theme disagree, which is a broken invariant rather than a value with an answer, so building one stops the program instead of handing out a slot no colour is painted for.

Constructors

Link copied to clipboard
constructor(slots: Int)

Properties

Link copied to clipboard
val slots: Int

Functions

Link copied to clipboard
fun slot(id: Long): Int

Which colour id is drawn on, from 0 to slots - 1.