Skip to content

Instantly share code, notes, and snippets.

@V-Abhilash-1999
Created May 23, 2023 12:30
Show Gist options
  • Save V-Abhilash-1999/af77abdcf9309c929ea17393cc32d8f5 to your computer and use it in GitHub Desktop.
Save V-Abhilash-1999/af77abdcf9309c929ea17393cc32d8f5 to your computer and use it in GitHub Desktop.
Column(
modifier = Modifier
.fillMaxSize(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
val hsv = remember {
val hsv = floatArrayOf(0f, 0f, 0f)
AndroidColor.colorToHSV(Color.Blue.toArgb(), hsv)
mutableStateOf(
Triple(hsv[0], hsv[1], hsv[2])
)
}
val backgroundColor = remember(hsv.value) {
mutableStateOf(Color.hsv(hsv.value.first, hsv.value.second, hsv.value.third))
}
SatValPanel(hue = hsv.value.first) { sat, value ->
hsv.value = Triple(hsv.value.first, sat, value)
}
Spacer(modifier = Modifier.height(32.dp))
HueBar { hue ->
hsv.value = Triple(hue, hsv.value.second, hsv.value.third)
}
Spacer(modifier = Modifier.height(32.dp))
Box(
modifier = Modifier
.size(100.dp)
.background(backgroundColor.value)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment