commonMain.Random.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of color Show documentation
Show all versions of color Show documentation
A collection of drawing/charting utilities
package com.juul.krayon.color
import kotlin.random.Random
/** Get a random [Color]. If [isOpaque] is `true` (the default), then alpha is guaranteed to be `0xFF`. */
public fun Random.nextColor(isOpaque: Boolean = true): Color = when (isOpaque) {
true -> Color((0xFF shl SHIFT_ALPHA) or (nextInt() and MASK_RGB))
false -> Color(nextInt())
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy