@@ -64,7 +64,6 @@ import top.yukonga.miuix.kmp.icon.icons.useful.Like
6464import top.yukonga.miuix.kmp.theme.MiuixTheme
6565import top.yukonga.miuix.kmp.utils.PressFeedbackType
6666import top.yukonga.miuix.kmp.utils.toHsv
67- import top.yukonga.miuix.kmp.utils.toOkLab
6867import kotlin.math.round
6968
7069fun LazyListScope.otherComponent (
@@ -590,16 +589,11 @@ fun LazyListScope.otherComponent(
590589 modifier = Modifier .padding(bottom = 12 .dp),
591590 verticalAlignment = Alignment .CenterVertically
592591 ) {
593- val hsv = selectedColor.toHsv()
594592 Text (
595593 text = " HEX: #${selectedColor.toArgb().toHexString(HexFormat .UpperCase )} " +
596594 " \n RGBA: ${(selectedColor.red * 255 ).toInt()} , " +
597595 " ${(selectedColor.green * 255 ).toInt()} , " +
598596 " ${(selectedColor.blue * 255 ).toInt()} , " +
599- " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " +
600- " \n HSVA: ${(hsv.h).toInt()} , " +
601- " ${(hsv.s).toInt()} %, " +
602- " ${(hsv.v).toInt()} %, " +
603597 " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " ,
604598 modifier = Modifier .weight(1f )
605599 )
@@ -629,16 +623,11 @@ fun LazyListScope.otherComponent(
629623 modifier = Modifier .padding(bottom = 12 .dp),
630624 verticalAlignment = Alignment .CenterVertically
631625 ) {
632- val hsv = selectedColor.toHsv()
633626 Text (
634627 text = " HEX: #${selectedColor.toArgb().toHexString(HexFormat .UpperCase )} " +
635628 " \n RGBA: ${(selectedColor.red * 255 ).toInt()} , " +
636629 " ${(selectedColor.green * 255 ).toInt()} , " +
637630 " ${(selectedColor.blue * 255 ).toInt()} , " +
638- " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " +
639- " \n HSVA: ${(hsv.h).toInt()} , " +
640- " ${(hsv.s).toInt()} %, " +
641- " ${(hsv.v).toInt()} %, " +
642631 " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " ,
643632 modifier = Modifier .weight(1f )
644633 )
@@ -653,7 +642,7 @@ fun LazyListScope.otherComponent(
653642 }
654643
655644 item(key = " colorPicker-okLab" ) {
656- SmallTitle (text = " ColorPicker (OKLAB )" )
645+ SmallTitle (text = " ColorPicker (okLab )" )
657646 val miuixColor = MiuixTheme .colorScheme.primary
658647 var selectedColor by remember { mutableStateOf(miuixColor) }
659648
@@ -668,16 +657,11 @@ fun LazyListScope.otherComponent(
668657 modifier = Modifier .padding(bottom = 12 .dp),
669658 verticalAlignment = Alignment .CenterVertically
670659 ) {
671- val ok = selectedColor.toOkLab()
672660 Text (
673661 text = " HEX: #${selectedColor.toArgb().toHexString(HexFormat .UpperCase )} " +
674662 " \n RGBA: ${(selectedColor.red * 255 ).toInt()} , " +
675663 " ${(selectedColor.green * 255 ).toInt()} , " +
676664 " ${(selectedColor.blue * 255 ).toInt()} , " +
677- " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " +
678- " \n OkLab: ${((ok.l * 1000 ).toInt() / 1000.0 )} , " +
679- " ${((ok.a * 1000 ).toInt() / 1000.0 )} , " +
680- " ${((ok.b * 1000 ).toInt() / 1000.0 )} / " +
681665 " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " ,
682666 modifier = Modifier .weight(1f )
683667 )
@@ -691,6 +675,41 @@ fun LazyListScope.otherComponent(
691675 }
692676 }
693677
678+ item(key = " colorPicker-okLch" ) {
679+ SmallTitle (text = " ColorPicker (OkLch)" )
680+ val miuixColor = MiuixTheme .colorScheme.primary
681+ var selectedColor by remember { mutableStateOf(miuixColor) }
682+
683+ Card (
684+ modifier = Modifier
685+ .fillMaxWidth()
686+ .padding(horizontal = 12 .dp)
687+ .padding(bottom = 12 .dp),
688+
689+ insideMargin = PaddingValues (16 .dp)
690+ ) {
691+ Row (
692+ modifier = Modifier .padding(bottom = 12 .dp),
693+ verticalAlignment = Alignment .CenterVertically
694+ ) {
695+ Text (
696+ text = " HEX: #${selectedColor.toArgb().toHexString(HexFormat .UpperCase )} " +
697+ " \n RGBA: ${(selectedColor.red * 255 ).toInt()} , " +
698+ " ${(selectedColor.green * 255 ).toInt()} , " +
699+ " ${(selectedColor.blue * 255 ).toInt()} , " +
700+ " ${(round(selectedColor.alpha * 100 ) / 100.0 )} " ,
701+ modifier = Modifier .weight(1f )
702+ )
703+ }
704+ ColorPicker (
705+ initialColor = selectedColor,
706+ onColorChanged = { selectedColor = it },
707+ hapticEffect = SliderDefaults .SliderHapticEffect .Step ,
708+ colorSpace = ColorSpace .OKLCH
709+ )
710+ }
711+ }
712+
694713 item(key = " colorPalette" ) {
695714 SmallTitle (text = " ColorPalette" )
696715 val miuixColor = MiuixTheme .colorScheme.primary
0 commit comments