Package-level declarations

Types

Link copied to clipboard
open class ColorContainer(val colors: MutableList<Int> = mutableListOf()) : ColorContainerInterface

A class for storing colors that can be used in animations. This can store a variable number of colors (stored as 24-bit Ints).

Link copied to clipboard
Link copied to clipboard
class PreparedColorContainer(val colors: List<Int>, val originalColors: List<Int> = listOf()) : ColorContainerInterface

A set of colors ready for use with a LED strip. Colors blend from one to the next along the length of the strip.

Properties

Link copied to clipboard
val Int.b: Int

Returns the 'blue' part of a 24-bit color.

Link copied to clipboard
val Int.g: Int

Returns the 'green' part of a 24-bit color.

Link copied to clipboard
val Int.r: Int

Returns the 'red' part of a 24-bit color.

Functions

Link copied to clipboard
infix fun Int.base(b: Int): String

Infix function for easily creating string representations of an Int in different bases.

Link copied to clipboard
fun blend(existing: Int, overlay: Int, amountOfOverlay: Int): Int

Blend two colors together and return a new color.

Link copied to clipboard
fun blend8(a: Int, b: Int, amountOfB: Int): Int

Blend a variable proportion (0-255) of one byte to another.

Link copied to clipboard

Replaces all colors in ColorContainer.colors with a grayscaled version of themselves.

Returns the 'grayscale' version of a 24-bit color.

Replaces the colors at the indices in the specified ranges with a grayscaled version of themselves.

Replaces the colors at the specified indices with a grayscaled version of themselves.

Link copied to clipboard

Returns a new ColorContainer with the same colors as this instance, but grayscaled.

Returns a new ColorContainer with the same colors as this instance, grayscaled, but only including the ranges of indices specified.

Returns a new ColorContainer with the same colors as this instance, grayscaled, but only including the indices specified.

Link copied to clipboard

Returns a new ColorContainer with the same colors as this instance, but inverted.

Returns a new ColorContainer with the same colors as this instance, inverted, but only including the ranges of indices specified.

Returns a new ColorContainer with the same colors as this instance, inverted, but only including the indices specified.

Link copied to clipboard

Replaces all colors in ColorContainer.colors with their inverse.

Replaces the colors at the indices in the specified ranges with their inverse

fun ColorContainer.invert(vararg indices: Int): ColorContainer

Replaces the colors at the specified indices with their inverse.

Link copied to clipboard

Report whether colors is empty

Link copied to clipboard

Report whether colors is not empty

Link copied to clipboard
fun parseHex(string: String): Int

Returns an Int from a hexadecimal string

Link copied to clipboard
fun parseHexOrDefault(string: String, default: Int = 0): Int

Returns an Int from a hexadecimal string or default on error

Link copied to clipboard

Helper function for removing the 0x prefix from a hex string

Link copied to clipboard

Create a PreparedColorContainer with the same colors as this PreparedColorContainer, shifted by offset. The color at index 0 will be moved to index offset. Negative offsets and offsets that are larger than the size of colors are supported.

Link copied to clipboard
fun ColorContainerInterface.shuffledWithIndices(): List<<Error class: unknown class><Int, Int>>
Link copied to clipboard
fun Int.toARGB(): Int

Convert a 24-bit Int to a 32-bit Int

fun Long.toARGB(): Int

Convert a 24-bit Long to a 32-bit Int

Link copied to clipboard

Create a ColorContainer from this Int

Create a ColorContainer from this Long

Link copied to clipboard

Operator overload that returns a new ColorContainer containing the inverse of the colors in this ColorContainer.