Some Color Adoptions
This commit is contained in:
parent
9eaf6f54ef
commit
613b56b892
3 changed files with 17 additions and 6 deletions
|
@ -34,7 +34,7 @@ fun PlayerCard(
|
|||
Text(
|
||||
text = player.name,
|
||||
fontSize = 2.5.em,
|
||||
color = Color.LightGray
|
||||
color = Color.White
|
||||
)
|
||||
Text(
|
||||
text = points.toString(),
|
||||
|
|
|
@ -85,7 +85,7 @@ fun Question(
|
|||
Text(
|
||||
text = "${questionData.actualDisplayPoints(secondRoundDouble)}",
|
||||
fontSize = 3.em,
|
||||
color = if (pointsButtonActive) Color.Gray else Color.LightGray
|
||||
color = if (pointsButtonActive) Color.Gray else Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,22 @@ import kotlinx.serialization.Serializable
|
|||
class ColorData(
|
||||
val red: Int,
|
||||
val green: Int,
|
||||
val blue: Int,
|
||||
val alpha: Int = 0xFF
|
||||
)
|
||||
val blue: Int
|
||||
) {
|
||||
|
||||
constructor(rgbHexString: String) : this(
|
||||
red = rgbHexString.redFromHex(),
|
||||
green = rgbHexString.greenFromHex(),
|
||||
blue = rgbHexString.blueFromHex()
|
||||
)
|
||||
}
|
||||
|
||||
internal fun String.colorFromHex(startPos: Int) = ("0x" + this[startPos] + this[startPos + 1]).toInt()
|
||||
internal fun String.redFromHex() = colorFromHex(2)
|
||||
internal fun String.greenFromHex() = colorFromHex(4)
|
||||
internal fun String.blueFromHex() = colorFromHex(6)
|
||||
|
||||
fun ColorData?.toColorOrNull() = this?.toColor()
|
||||
fun ColorData?.toColorOrDefault() = this?.toColor() ?: Color.Blue
|
||||
|
||||
fun ColorData.toColor() = Color(red, green, blue, alpha)
|
||||
fun ColorData.toColor() = Color(red, green, blue)
|
||||
|
|
Loading…
Reference in a new issue