Skip to content

Commit 0c6161a

Browse files
committed
#2087 fix: small segmented button text is not readable in dark mode
1 parent 6fc8801 commit 0c6161a

3 files changed

Lines changed: 43 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- #2045 add action to input on-screen keyboard enter/send button.
88
- #2106 disable the keyboard auto-switching setting when manually switching the keyboard in the Key Mapper homescreen menu.
99
- #2081 add getevent debug screen.
10+
- #2087 small segmented button text is not readable in dark mode.
1011

1112
## Fixed
1213

base/src/main/java/io/github/sds100/keymapper/base/trigger/BaseTriggerScreen.kt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,25 @@ private fun VerticalPreview() {
640640
}
641641
}
642642

643+
@Preview(device = Devices.PIXEL)
644+
@Composable
645+
private fun VerticalPreviewDark() {
646+
KeyMapperTheme(darkTheme = true) {
647+
TriggerScreenVertical(
648+
configState = previewState,
649+
recordTriggerState = RecordTriggerState.Idle,
650+
expertModeSwitchState = ExpertModeRecordSwitchState(
651+
isVisible = true,
652+
isChecked = false,
653+
isEnabled = true,
654+
),
655+
discoverScreenContent = {
656+
TriggerDiscoverScreen()
657+
},
658+
)
659+
}
660+
}
661+
643662
@Preview(heightDp = 300, widthDp = 300)
644663
@Composable
645664
private fun VerticalPreviewTiny() {
@@ -659,6 +678,25 @@ private fun VerticalPreviewTiny() {
659678
}
660679
}
661680

681+
@Preview(heightDp = 300, widthDp = 300)
682+
@Composable
683+
private fun VerticalPreviewTinyDark() {
684+
KeyMapperTheme(darkTheme = true) {
685+
TriggerScreenVertical(
686+
configState = previewState,
687+
recordTriggerState = RecordTriggerState.Idle,
688+
expertModeSwitchState = ExpertModeRecordSwitchState(
689+
isVisible = true,
690+
isChecked = true,
691+
isEnabled = true,
692+
),
693+
discoverScreenContent = {
694+
TriggerDiscoverScreen()
695+
},
696+
)
697+
}
698+
}
699+
662700
// This preview is slightly rectangular
663701
@Preview(heightDp = 500, widthDp = 530)
664702
@Composable

base/src/main/java/io/github/sds100/keymapper/base/utils/ui/compose/KeyMapperSegmentedButtonRow.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.height
44
import androidx.compose.foundation.text.BasicText
55
import androidx.compose.foundation.text.TextAutoSize
66
import androidx.compose.material3.ExperimentalMaterial3Api
7+
import androidx.compose.material3.LocalContentColor
78
import androidx.compose.material3.LocalTextStyle
89
import androidx.compose.material3.MaterialTheme
910
import androidx.compose.material3.SegmentedButton
@@ -70,6 +71,8 @@ fun <T> KeyMapperSegmentedButtonRow(
7071
),
7172
colors = colors,
7273
) {
74+
val contentColor = LocalContentColor.current
75+
7376
BasicText(
7477
modifier = if (isUnselectedDisabled) Modifier.alpha(0.5f) else Modifier,
7578
text = label,
@@ -79,6 +82,7 @@ fun <T> KeyMapperSegmentedButtonRow(
7982
maxFontSize = LocalTextStyle.current.fontSize,
8083
minFontSize = 10.sp,
8184
),
85+
color = { contentColor },
8286
)
8387
}
8488
} else {

0 commit comments

Comments
 (0)