PolyColor

open class PolyColor @JvmOverloads constructor(hue: Float, saturation: Float, brightness: Float, alpha: Float = 1.0f) : Cloneable

Color

The color used by PolyUI. It stores the color in the HSBA format, and can be converted to ARGB.

See also

Inheritors

Constructors

Link copied to clipboard
constructor(hsb: FloatArray, alpha: Float = 1.0f)
constructor(rgba: IntArray)
constructor(r: Int, g: Int, b: Int, alpha: Float = 1.0f)
constructor(hue: Float, saturation: Float, brightness: Float, alpha: Float = 1.0f)

Types

Link copied to clipboard
open class Animated(hue: Float, saturation: Float, brightness: Float, alpha: Float) : PolyColor

An animatable version of Color, that supports recoloring with animations.

Link copied to clipboard
object Companion
Link copied to clipboard
class Gradient @JvmOverloads constructor(color1: Color, color2: Color, val type: PolyColor.Gradient.Type = Type.TopLeftToBottomRight) : PolyColor.Animated

A gradient color.

Properties

Link copied to clipboard
@get:JvmName(name = "alpha")
val a: Int

alpha value of this color, from 0 to 255

Link copied to clipboard

The alpha of this color. Clamped between 0f..1f.

Link copied to clipboard
@get:JvmName(name = "getARGB")
var argb: Int

return an integer representation of this color. Utilizes bit-shifts to store the color as one 32-bit integer, like so:

Link copied to clipboard
@get:JvmName(name = "blue")
val b: Int

blue value of this color, from 0 to 255

Link copied to clipboard

The brightness of this color. Clamped between 0f..1f.

Link copied to clipboard

Set this to true to update the argb value.

Link copied to clipboard
@get:JvmName(name = "green")
val g: Int

green value of this color, from 0 to 255

Link copied to clipboard
var hue: Float

The hue of this color. Can be any value, but is mod 360, so values are always between 0 and 360.

Link copied to clipboard
@get:JvmName(name = "red")
val r: Int

red value of this color, from 0 to 255

Link copied to clipboard

The saturation of this color. Clamped between 0f..1f.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun clone(): PolyColor
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
@ApiStatus.Experimental
fun <S : Drawable> PolyColor.makeChroma(speedNanos: Ref.LongRef = 5.seconds.toChromaSpeed()): DrawableOp

Make the given color chroma, meaning it will change its hue over time.

Link copied to clipboard
fun take(color: Color): Color
Link copied to clipboard
Link copied to clipboard

Return a static java Color object of this color at the instant this method is called.

Link copied to clipboard
open override fun toString(): String