Skip to content

Companion

object Companion

Properties

BLACK

val BLACK: KColor

BLUE

val BLUE: KColor

CYAN

val CYAN: KColor

DARK_GRAY

GRAY

val GRAY: KColor

GREEN

val GREEN: KColor

LIGHT_BLUE

LIGHT_GRAY

MAGENTA

ORANGE

val ORANGE: KColor

PINK

val PINK: KColor

RED

val RED: KColor

WHITE

val WHITE: KColor

YELLOW

val YELLOW: KColor

Functions

ofArgb

fun ofArgb(argb: Long): KColor

Creates a KColor from a packed ARGB Long in the form 0xAARRGGBB.

Parameters

  • argb: The packed ARGB value.

ofDye

fun ofDye(dye: DyeColor): KColor

Creates a KColor from a Minecraft DyeColor.

Parameters

  • dye: The dye colour.

ofFormatting

fun ofFormatting(formatting: ChatFormatting): KColor

Creates a KColor from the colour associated with a ChatFormatting constant.

Parameters

  • formatting: A ChatFormatting value with an associated colour.

ofHsv

fun ofHsv(
    hue: Float, 
    saturation: Float, 
    value: Float
): KColor

Creates a KColor from HSV (Hue, Saturation, Value) components with full opacity.

Parameters

  • hue: Hue in the range 0, 1.

  • saturation: Saturation in the range 0, 1.

  • value: Value (brightness) in the range 0, 1.

fun ofHsv(
    hue: Float, 
    saturation: Float, 
    value: Float, 
    alpha: Float
): KColor

Creates a KColor from HSV components with a custom alpha.

Parameters

  • hue: Hue in the range 0, 1.

  • saturation: Saturation in the range 0, 1.

  • value: Value (brightness) in the range 0, 1.

  • alpha: Alpha in the range 0, 1 (0 = fully transparent, 1 = opaque).

ofRgb

fun ofRgb(rgb: Int): KColor

Creates an opaque KColor from a packed RGB Int in the form 0xRRGGBB.

Parameters

  • rgb: The packed RGB value (alpha is set to 255).

random

fun random(alpha: Boolean = true): KColor

Generates a random KColor.

Parameters

  • alpha: Whether the alpha channel should also be randomized. When false the colour is fully opaque.