@@ -44,6 +44,7 @@ import top.yukonga.miuix.kmp.basic.Card
4444import top.yukonga.miuix.kmp.basic.CardDefaults
4545import top.yukonga.miuix.kmp.basic.CircularProgressIndicator
4646import top.yukonga.miuix.kmp.basic.ColorPicker
47+ import top.yukonga.miuix.kmp.basic.ColorSpace
4748import top.yukonga.miuix.kmp.basic.Icon
4849import top.yukonga.miuix.kmp.basic.InfiniteProgressIndicator
4950import top.yukonga.miuix.kmp.basic.LinearProgressIndicator
@@ -311,8 +312,8 @@ fun LazyListScope.otherComponent(
311312 }
312313 }
313314
314- item(key = " colorPicker-hsva " ) {
315- SmallTitle (text = " ColorPicker (HSVA )" )
315+ item(key = " colorPicker-hsv " ) {
316+ SmallTitle (text = " ColorPicker (HSV )" )
316317 val miuixColor = MiuixTheme .colorScheme.primary
317318 var selectedColor by remember { mutableStateOf(miuixColor) }
318319
@@ -349,8 +350,48 @@ fun LazyListScope.otherComponent(
349350 }
350351 }
351352
353+ item(key = " colorPicker-okHsv" ) {
354+ SmallTitle (text = " ColorPicker (OKHSV)" )
355+ val miuixColor = MiuixTheme .colorScheme.primary
356+ var selectedColor by remember { mutableStateOf(miuixColor) }
357+
358+ Card (
359+ modifier = Modifier
360+ .fillMaxWidth()
361+ .padding(horizontal = 12 .dp)
362+ .padding(bottom = 6 .dp),
363+
364+ insideMargin = PaddingValues (16 .dp)
365+ ) {
366+ Row (
367+ modifier = Modifier .padding(bottom = 12 .dp),
368+ verticalAlignment = Alignment .CenterVertically
369+ ) {
370+ val hsv = colorToHsv(selectedColor)
371+ Text (
372+ text = " HEX: #${selectedColor.toArgb().toHexString(HexFormat .UpperCase )} " +
373+ " \n RGBA: ${(selectedColor.red * 255 ).toInt()} , " +
374+ " ${(selectedColor.green * 255 ).toInt()} , " +
375+ " ${(selectedColor.blue * 255 ).toInt()} , " +
376+ " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " +
377+ " \n HSVA: ${(hsv[0 ]).toInt()} , " +
378+ " ${(hsv[1 ] * 100 ).toInt()} %, " +
379+ " ${(hsv[2 ] * 100 ).toInt()} %, " +
380+ " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " ,
381+ modifier = Modifier .weight(1f )
382+ )
383+ }
384+ ColorPicker (
385+ initialColor = selectedColor,
386+ onColorChanged = { selectedColor = it },
387+ hapticEffect = SliderDefaults .SliderHapticEffect .Step ,
388+ colorSpace = ColorSpace .OKHSV
389+ )
390+ }
391+ }
392+
352393 item(key = " colorPicker-okLab" ) {
353- SmallTitle (text = " ColorPicker (OkLab )" )
394+ SmallTitle (text = " ColorPicker (OKLAB )" )
354395 val miuixColor = MiuixTheme .colorScheme.primary
355396 var selectedColor by remember { mutableStateOf(miuixColor) }
356397
@@ -384,7 +425,7 @@ fun LazyListScope.otherComponent(
384425 initialColor = selectedColor,
385426 onColorChanged = { selectedColor = it },
386427 hapticEffect = SliderDefaults .SliderHapticEffect .Step ,
387- useOkLab = true
428+ colorSpace = ColorSpace . OKLAB
388429 )
389430 }
390431 }
0 commit comments