← back to roto on ba3a.dev

PaletteAddition

Appends a colour to a project's palette file, after the colours already there. Only a .hex palette with room for one more colour, and without that colour, can take it; unavailableReason says which of these fails, in words fit to show the artist. A palette file that cannot be read or written is an java.io.IOException.

Functions

Link copied to clipboard
fun add(project: Project, colour: Int): Palette

Writes project's palette file with the opaque colour appended, and returns the new palette. When unavailableReason gives a reason, nothing is written and an IllegalArgumentException carries it.

Link copied to clipboard
fun unavailableReason(project: Project, colour: Int): String?

Why colour cannot be added to project's palette file, or null when it can.