Skip to content

Commit 5ebbb5d

Browse files
committed
Fix the light mode content colors and the text style sizes
The button label style no longer bakes a color, so it follows the button content color, and the secondary and alert styles use the on-accent text tokens with textDisabled as the disabled content color. Titles map the four style sizes to the four heading sizes and body reads its size again. CallContent and AudioRoomContent no longer set the Scaffold content color to the app background. The demo bad-network pill and the ringing tutorial surfaces use surface, border and on-accent tokens. Affected goldens are re-recorded.
1 parent 97d64e0 commit 5ebbb5d

25 files changed

Lines changed: 44 additions & 30 deletions

File tree

demo-app/src/main/kotlin/io/getstream/video/android/ui/call/CallScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -883,14 +883,14 @@ private fun BadNetworkLabel(
883883
.align(CenterVertically),
884884
imageVector = Icons.Default.SignalWifiBad,
885885
contentDescription = null,
886-
tint = VideoTheme.colors.textPrimary,
886+
tint = VideoTheme.colors.textOnAccent,
887887
)
888888
Text(
889889
modifier = Modifier.padding(12.dp),
890890
text = stringResource(
891891
id = io.getstream.video.android.ui.common.R.string.stream_video_call_bad_network,
892892
),
893-
color = VideoTheme.colors.textPrimary,
893+
color = VideoTheme.colors.textOnAccent,
894894
textAlign = TextAlign.Center,
895895
fontSize = 14.sp,
896896
)

stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/audio/AudioRoomContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public fun AudioRoomContent(
155155
modifier = modifier
156156
.background(VideoTheme.colors.backgroundCoreApp)
157157
.padding(32.dp),
158-
contentColor = VideoTheme.colors.backgroundCoreApp,
158+
contentColor = VideoTheme.colors.textPrimary,
159159
topBar = {
160160
if (isShowingAppBar) {
161161
appBarContent.invoke(call)

stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/base/StreamButton.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import androidx.compose.foundation.layout.width
3434
import androidx.compose.material.Button
3535
import androidx.compose.material.CircularProgressIndicator
3636
import androidx.compose.material.Icon
37+
import androidx.compose.material.LocalContentColor
3738
import androidx.compose.material.Text
3839
import androidx.compose.runtime.Composable
3940
import androidx.compose.runtime.State
@@ -111,7 +112,7 @@ public fun StreamButton(
111112
)
112113
if (showProgress) {
113114
CircularProgressIndicator(
114-
color = textStyle.value.platform.color,
115+
color = LocalContentColor.current,
115116
modifier = Modifier.height(StreamTokens.size8),
116117
)
117118
}

stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/base/styling/StreamButtonStyle.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ public open class ButtonStyleProvider {
181181
backgroundColor = VideoTheme.colors.buttonSecondaryBg,
182182
contentColor = VideoTheme.colors.textPrimary,
183183
disabledBackgroundColor = VideoTheme.colors.backgroundUtilityDisabled,
184+
disabledContentColor = VideoTheme.colors.textDisabled,
184185
),
185186
contentPadding = PaddingValues(
186187
start = StreamTokens.spacingMd,
@@ -195,8 +196,9 @@ public open class ButtonStyleProvider {
195196
genericButtonStyle(size = size).copy(
196197
colors = ButtonDefaults.buttonColors(
197198
backgroundColor = VideoTheme.colors.buttonPrimaryBg,
198-
contentColor = VideoTheme.colors.textPrimary,
199+
contentColor = VideoTheme.colors.buttonPrimaryTextOnAccent,
199200
disabledBackgroundColor = VideoTheme.colors.backgroundUtilityDisabled,
201+
disabledContentColor = VideoTheme.colors.textDisabled,
200202
),
201203
)
202204

@@ -207,6 +209,7 @@ public open class ButtonStyleProvider {
207209
backgroundColor = VideoTheme.colors.backgroundCoreApp,
208210
contentColor = VideoTheme.colors.textPrimary,
209211
disabledBackgroundColor = VideoTheme.colors.backgroundCoreApp,
212+
disabledContentColor = VideoTheme.colors.textDisabled,
210213
),
211214
border = BorderStroke(1.dp, VideoTheme.colors.borderCoreDefault),
212215
)
@@ -218,6 +221,7 @@ public open class ButtonStyleProvider {
218221
backgroundColor = VideoTheme.colors.buttonSecondaryBg,
219222
contentColor = VideoTheme.colors.textPrimary,
220223
disabledBackgroundColor = VideoTheme.colors.backgroundUtilityDisabled,
224+
disabledContentColor = VideoTheme.colors.textDisabled,
221225
),
222226
iconStyle = IconStyles.customColorIconStyle(
223227
color = VideoTheme.colors.accentPrimary,
@@ -231,6 +235,7 @@ public open class ButtonStyleProvider {
231235
backgroundColor = VideoTheme.colors.backgroundCoreApp,
232236
contentColor = VideoTheme.colors.textPrimary,
233237
disabledBackgroundColor = VideoTheme.colors.backgroundCoreApp,
238+
disabledContentColor = VideoTheme.colors.textDisabled,
234239
),
235240
)
236241

@@ -239,8 +244,9 @@ public open class ButtonStyleProvider {
239244
genericButtonStyle(size = size).copy(
240245
colors = ButtonDefaults.buttonColors(
241246
backgroundColor = VideoTheme.colors.buttonDestructiveBg,
242-
contentColor = VideoTheme.colors.textPrimary,
247+
contentColor = VideoTheme.colors.buttonDestructiveTextOnAccent,
243248
disabledBackgroundColor = VideoTheme.colors.backgroundUtilityDisabled,
249+
disabledContentColor = VideoTheme.colors.textDisabled,
244250
),
245251
)
246252

@@ -383,6 +389,7 @@ public open class ButtonStyleProvider {
383389
backgroundColor = VideoTheme.colors.buttonSecondaryBg,
384390
contentColor = VideoTheme.colors.textPrimary,
385391
disabledBackgroundColor = VideoTheme.colors.backgroundUtilityDisabled,
392+
disabledContentColor = VideoTheme.colors.textDisabled,
386393
),
387394
drawableStyle = ButtonDrawableStyles.defaultButtonDrawableStyle(),
388395
),
@@ -408,6 +415,7 @@ public open class ButtonStyleProvider {
408415
backgroundColor = VideoTheme.colors.backgroundCoreApp,
409416
contentColor = VideoTheme.colors.textPrimary,
410417
disabledBackgroundColor = VideoTheme.colors.backgroundCoreApp,
418+
disabledContentColor = VideoTheme.colors.textDisabled,
411419
),
412420
drawableStyle = ButtonDrawableStyles.customColorFilterButtonDrawableStyle(
413421
colorFilter = ColorFilter.lighting(Color.Gray, Color.Transparent),

stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/base/styling/TextStyles.kt

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package io.getstream.video.android.compose.ui.components.base.styling
1818

1919
import androidx.compose.runtime.Composable
2020
import androidx.compose.ui.graphics.Color
21+
import androidx.compose.ui.graphics.isSpecified
2122
import androidx.compose.ui.text.TextStyle
2223
import io.getstream.video.android.compose.theme.VideoTheme
2324

@@ -59,13 +60,9 @@ public open class TextStyleProvider {
5960
public fun defaultButtonLabel(
6061
size: StyleSize = StyleSize.L,
6162
default: TextStyleWrapper = when (size) {
62-
StyleSize.XS, StyleSize.S -> VideoTheme.typography.metadataEmphasis.withColor(
63-
VideoTheme.colors.textPrimary,
64-
)
65-
StyleSize.M -> VideoTheme.typography.captionEmphasis.withColor(
66-
VideoTheme.colors.textPrimary,
67-
)
68-
else -> VideoTheme.typography.bodyEmphasis.withColor(VideoTheme.colors.textPrimary)
63+
StyleSize.XS, StyleSize.S -> VideoTheme.typography.metadataEmphasis.wrapper()
64+
StyleSize.M -> VideoTheme.typography.captionEmphasis.wrapper()
65+
else -> VideoTheme.typography.bodyEmphasis.wrapper()
6966
},
7067
pressed: TextStyleWrapper = default,
7168
disabled: TextStyleWrapper = default.disabledAlpha(),
@@ -75,11 +72,11 @@ public open class TextStyleProvider {
7572
public fun defaultTitle(
7673
size: StyleSize = StyleSize.L,
7774
default: TextStyleWrapper = when (size) {
78-
StyleSize.XS -> VideoTheme.typography.headingExtraSmall.withColor(
79-
VideoTheme.colors.textPrimary,
80-
)
81-
else -> VideoTheme.typography.headingLarge.withColor(VideoTheme.colors.textPrimary)
82-
},
75+
StyleSize.XS -> VideoTheme.typography.headingExtraSmall
76+
StyleSize.S -> VideoTheme.typography.headingSmall
77+
StyleSize.M -> VideoTheme.typography.headingMedium
78+
else -> VideoTheme.typography.headingLarge
79+
}.withColor(VideoTheme.colors.textPrimary),
8380
pressed: TextStyleWrapper = default,
8481
disabled: TextStyleWrapper = default.disabledAlpha(),
8582
): StreamTextStyle = StreamTextStyle(default, disabled, pressed)
@@ -103,9 +100,10 @@ public open class TextStyleProvider {
103100
@Composable
104101
public fun defaultBody(
105102
size: StyleSize = StyleSize.L,
106-
default: TextStyleWrapper = VideoTheme.typography.bodyDefault.withColor(
107-
VideoTheme.colors.textSecondary,
108-
),
103+
default: TextStyleWrapper = when (size) {
104+
StyleSize.XS, StyleSize.S -> VideoTheme.typography.captionDefault
105+
else -> VideoTheme.typography.bodyDefault
106+
}.withColor(VideoTheme.colors.textSecondary),
109107
pressed: TextStyleWrapper = default,
110108
disabled: TextStyleWrapper = default.disabledAlpha(),
111109
): StreamTextStyle = StreamTextStyle(default, disabled, pressed)
@@ -147,10 +145,11 @@ internal fun TextStyle.withColor(color: Color) = TextStyleWrapper(
147145
),
148146
)
149147

150-
internal fun TextStyleWrapper.withAlpha(alpha: Float): TextStyleWrapper = this.platform.copy(
151-
color = this.platform.color.copy(
152-
alpha = alpha,
153-
),
154-
).wrapper()
148+
internal fun TextStyleWrapper.withAlpha(alpha: Float): TextStyleWrapper =
149+
if (this.platform.color.isSpecified) {
150+
this.platform.copy(color = this.platform.color.copy(alpha = alpha)).wrapper()
151+
} else {
152+
this
153+
}
155154

156155
internal fun TextStyleWrapper.disabledAlpha() = this.withAlpha(0.16f)

stream-video-android-ui-compose/src/main/kotlin/io/getstream/video/android/compose/ui/components/call/activecall/CallContent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public fun CallContent(
192192
} else {
193193
Scaffold(
194194
backgroundColor = VideoTheme.colors.backgroundCoreApp,
195-
contentColor = VideoTheme.colors.backgroundCoreApp,
195+
contentColor = VideoTheme.colors.textPrimary,
196196
topBar = {
197197
if (orientation == ORIENTATION_PORTRAIT) {
198198
appBarContent.invoke(call)
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)