Color

value class Color(val argb: Int)

A color in ARGB color space.

Constructors

Link copied to clipboard
constructor(alpha: Int, red: Int, green: Int, blue: Int)

Create a color from component integers. Components are masked to their last eight bits.

constructor(red: Int, green: Int, blue: Int)

Create an opaque color from component integers. Components are masked to their last eight bits.

constructor(alpha: Float, red: Float, green: Float, blue: Float)

Create a color from component floats. Components are multiplied by 255 and rounded.

constructor(red: Float, green: Float, blue: Float)

Create an opaque color from component floats. Components are multiplied by 255 and rounded.

constructor(argb: Int)

Properties

Link copied to clipboard
val alpha: Int

Gets the alpha component of this color as an eight bit integer.

Link copied to clipboard
val argb: Int
Link copied to clipboard
val blue: Int

Gets the blue component of this color as an eight bit integer.

Link copied to clipboard
val green: Int

Gets the green component of this color as an eight bit integer.

Link copied to clipboard
val red: Int

Gets the red component of this color as an eight bit integer.

Link copied to clipboard
val rgb: Int

Gets the rgb component of this color as a 24 bit integer.

Functions

Link copied to clipboard
fun copy(alpha: Int = this.alpha, red: Int = this.red, green: Int = this.green, blue: Int = this.blue): Color

Creates a copy of this color.

Link copied to clipboard

Returns this as a string in web-friendly hex notation.

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