Jan
@Composable fun ColorPicker(modifier: Modifier = Modifier, onSelect: (Color) -> Unit) { BoxWithConstraints { var selectedColor by remember { mutableStateOf(Color.Red) } Box( modifier = modifier .fillMaxSize() .background(Brush.horizontalGradient(colors())) ) { } } } fun colors(n: Int = 359): List<Color> { val cols = mutableListOf<Color>() for (i in 0 until n) { val color = java.awt.Color.getHSBColor(i.toFloat() / n.toFloat(), 0.85f, 1.0f) cols.add(Color(color.red, color.green, color.blue, color.alpha)) } return cols }
Chris Sinco [G]
Tobias Suchalla
A modern programming language that makes developers happier.