Merge pull request #4226 from element-hq/feature/bma/themeOverride

Theme override
This commit is contained in:
Benoit Marty 2025-02-06 16:48:16 +01:00 committed by GitHub
commit 98f793b02e
111 changed files with 293 additions and 275 deletions

View file

@ -31,6 +31,7 @@ android {
implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.coil.compose)
implementation(libs.vanniktech.blurhash)
implementation(projects.features.enterprise.api)
implementation(projects.libraries.architecture)
implementation(projects.libraries.preferences.api)
implementation(projects.libraries.testtags)

View file

@ -7,24 +7,24 @@
package io.element.android.libraries.designsystem
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import io.element.android.compound.theme.ElementTheme
@Composable
fun Boolean.toEnabledColor(): Color {
return if (this) {
MaterialTheme.colorScheme.primary
ElementTheme.colors.textPrimary
} else {
MaterialTheme.colorScheme.primary.copy(alpha = 0.40f)
ElementTheme.colors.textDisabled
}
}
@Composable
fun Boolean.toSecondaryEnabledColor(): Color {
return if (this) {
MaterialTheme.colorScheme.secondary
ElementTheme.colors.textSecondary
} else {
MaterialTheme.colorScheme.secondary.copy(alpha = 0.40f)
ElementTheme.colors.textDisabled
}
}

View file

@ -33,7 +33,7 @@ fun RedIndicatorAtom(
Box(
modifier = modifier
.size(size)
.border(borderSize, ElementTheme.materialColors.background, CircleShape)
.border(borderSize, ElementTheme.colors.bgCanvasDefault, CircleShape)
.padding(borderSize / 2)
.clip(CircleShape)
.background(color)

View file

@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Home
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -45,7 +44,7 @@ fun RoundedIconAtom(
size: RoundedIconAtomSize = RoundedIconAtomSize.Big,
resourceId: Int? = null,
imageVector: ImageVector? = null,
tint: Color = MaterialTheme.colorScheme.secondary,
tint: Color = ElementTheme.colors.iconSecondary,
backgroundTint: Color = ElementTheme.colors.temporaryColorBgSpecial,
) {
Box(

View file

@ -58,7 +58,7 @@ fun ComposerAlertMolecule(
)
val startColor = if (isCritical) ElementTheme.colors.bgCriticalSubtle else ElementTheme.colors.bgInfoSubtle
val brush = Brush.verticalGradient(
listOf(startColor, ElementTheme.materialColors.background),
listOf(startColor, ElementTheme.colors.bgCanvasDefault),
)
Box(
modifier = Modifier

View file

@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -51,7 +50,7 @@ fun IconTitleSubtitleMolecule(
.fillMaxWidth(),
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontHeadingMdBold,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
if (subTitle != null) {
Spacer(Modifier.height(8.dp))
@ -60,7 +59,7 @@ fun IconTitleSubtitleMolecule(
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
}
}

View file

@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.movableContentOf
import androidx.compose.runtime.remember
@ -46,7 +45,7 @@ import io.element.android.libraries.designsystem.theme.components.Text
fun HeaderFooterPage(
modifier: Modifier = Modifier,
paddingValues: PaddingValues = PaddingValues(20.dp),
containerColor: Color = MaterialTheme.colorScheme.background,
containerColor: Color = ElementTheme.colors.bgCanvasDefault,
isScrollable: Boolean = false,
background: @Composable () -> Unit = {},
topBar: @Composable () -> Unit = {},

View file

@ -9,13 +9,13 @@ package io.element.android.libraries.designsystem.background
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.center
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RadialGradientShader
import androidx.compose.ui.graphics.ShaderBrush
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
@ -25,7 +25,7 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
@Composable
fun LightGradientBackground(
modifier: Modifier = Modifier,
backgroundColor: Color = MaterialTheme.colorScheme.background,
backgroundColor: Color = ElementTheme.colors.bgCanvasDefault,
firstColor: Color = Color(0x1E0DBD8B),
secondColor: Color = Color(0x001273EB),
ratio: Float = 642 / 775f,

View file

@ -477,7 +477,7 @@ internal fun BloomPreview() {
}
.bloom(
hash = blurhash,
background = ElementTheme.materialColors.background,
background = ElementTheme.colors.bgCanvasDefault,
blurSize = DpSize(430.dp, 430.dp),
offset = DpOffset(24.dp, 24.dp),
clipToSize = if (topAppBarHeight > 0) DpSize(430.dp, topAppBarHeight.toDp()) else DpSize.Zero,
@ -554,9 +554,9 @@ internal fun BloomInitialsPreview(@PreviewParameter(InitialsColorIntProvider::cl
// Workaround to display a very subtle bloom for avatars with very soft colors
Color(0xFFF9F9F9)
} else {
ElementTheme.materialColors.background
ElementTheme.colors.bgCanvasDefault
},
bottomSoftEdgeColor = ElementTheme.materialColors.background,
bottomSoftEdgeColor = ElementTheme.colors.bgCanvasDefault,
blurSize = DpSize(256.dp, 256.dp),
),
contentAlignment = Alignment.Center

View file

@ -9,11 +9,11 @@ package io.element.android.libraries.designsystem.components
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
import io.element.android.libraries.designsystem.preview.PreviewGroup
import io.element.android.libraries.designsystem.theme.components.Checkbox
@ -38,7 +38,7 @@ fun LabelledCheckbox(
)
Text(
text = text,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
}
}

View file

@ -26,6 +26,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
import io.element.android.libraries.designsystem.preview.PreviewGroup
@ -64,13 +65,13 @@ fun ProgressDialog(
when (type) {
is ProgressDialogType.Indeterminate -> {
CircularProgressIndicator(
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.iconPrimary
)
}
is ProgressDialogType.Determinate -> {
CircularProgressIndicator(
progress = { type.progress },
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.iconPrimary
)
}
}
@ -93,7 +94,7 @@ private fun ProgressDialogContent(
onCancelClick: () -> Unit = {},
progressIndicator: @Composable () -> Unit = {
CircularProgressIndicator(
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.iconPrimary
)
}
) {
@ -114,7 +115,7 @@ private fun ProgressDialogContent(
Spacer(modifier = Modifier.height(22.dp))
Text(
text = text,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
}
if (showCancelButton) {

View file

@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@ -58,17 +57,16 @@ fun MainActionButton(
.widthIn(min = 76.dp, max = 96.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
val tintColor = if (enabled) LocalContentColor.current else MaterialTheme.colorScheme.secondary
Icon(
imageVector = imageVector,
contentDescription = contentDescription,
tint = tintColor,
tint = if (enabled) LocalContentColor.current else ElementTheme.colors.iconDisabled,
)
Spacer(modifier = Modifier.height(14.dp))
Text(
title,
style = ElementTheme.typography.fontBodyMdMedium.copy(hyphens = Hyphens.Auto),
color = tintColor,
color = if (enabled) LocalContentColor.current else ElementTheme.colors.textDisabled,
overflow = TextOverflow.Visible,
textAlign = TextAlign.Center,
)

View file

@ -7,7 +7,6 @@
package io.element.android.libraries.designsystem.theme
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import io.element.android.compound.annotations.CoreColorToken
@ -24,13 +23,13 @@ import kotlinx.collections.immutable.persistentMapOf
* Room list.
*/
@Composable
fun MaterialTheme.roomListRoomName() = colorScheme.primary
fun ElementTheme.roomListRoomName() = colors.textPrimary
@Composable
fun MaterialTheme.roomListRoomMessage() = colorScheme.secondary
fun ElementTheme.roomListRoomMessage() = colors.textSecondary
@Composable
fun MaterialTheme.roomListRoomMessageDate() = colorScheme.secondary
fun ElementTheme.roomListRoomMessageDate() = colors.textSecondary
val SemanticColors.unreadIndicator
get() = iconAccentTertiary
@ -181,9 +180,9 @@ internal fun ColorAliasesPreview() = ElementPreview {
backgroundColor = Color.Black,
foregroundColor = Color.White,
colors = persistentMapOf(
"roomListRoomName" to MaterialTheme.roomListRoomName(),
"roomListRoomMessage" to MaterialTheme.roomListRoomMessage(),
"roomListRoomMessageDate" to MaterialTheme.roomListRoomMessageDate(),
"roomListRoomName" to ElementTheme.roomListRoomName(),
"roomListRoomMessage" to ElementTheme.roomListRoomMessage(),
"roomListRoomMessageDate" to ElementTheme.roomListRoomMessageDate(),
"unreadIndicator" to ElementTheme.colors.unreadIndicator,
"placeholderBackground" to ElementTheme.colors.placeholderBackground,
"messageFromMeBackground" to ElementTheme.colors.messageFromMeBackground,

View file

@ -17,6 +17,7 @@ import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.theme.Theme
import io.element.android.compound.theme.isDark
import io.element.android.compound.theme.mapToTheme
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
/**
@ -29,6 +30,7 @@ import io.element.android.libraries.preferences.api.store.AppPreferencesStore
@Composable
fun ElementThemeApp(
appPreferencesStore: AppPreferencesStore,
enterpriseService: EnterpriseService,
content: @Composable () -> Unit,
) {
val theme by remember {
@ -44,8 +46,12 @@ fun ElementThemeApp(
}
)
}
val compoundLight = remember { enterpriseService.semanticColorsLight() }
val compoundDark = remember { enterpriseService.semanticColorsDark() }
ElementTheme(
darkTheme = theme.isDark(),
content = content,
compoundLight = compoundLight,
compoundDark = compoundDark,
)
}

View file

@ -159,7 +159,7 @@ internal fun SimpleAlertDialogContent(
// most cases, TextButtons should be used for dismiss and confirm buttons.
// TextButtons will not consume this provided content color value, and will used their
// own defined or default colors.
buttonContentColor = MaterialTheme.colorScheme.primary,
buttonContentColor = ElementTheme.colors.textPrimary,
applyPaddingToContents = applyPaddingToContents,
)
}

View file

@ -314,7 +314,7 @@ internal enum class ButtonStyle {
contentColor = if (destructive) {
ElementTheme.colors.textCriticalPrimary
} else {
if (LocalContentColor.current.isSpecified) LocalContentColor.current else ElementTheme.materialColors.primary
if (LocalContentColor.current.isSpecified) LocalContentColor.current else ElementTheme.colors.textPrimary
},
disabledContainerColor = Color.Transparent,
disabledContentColor = getDisabledContentColor(destructive),

View file

@ -106,7 +106,7 @@ fun <T> SearchBar(
Icon(
imageVector = CompoundIcons.Search(),
contentDescription = stringResource(CommonStrings.action_search),
tint = ElementTheme.materialColors.tertiary,
tint = ElementTheme.colors.iconTertiary,
)
}
}
@ -138,7 +138,7 @@ fun <T> SearchBar(
Text(
text = stringResource(CommonStrings.common_no_results),
textAlign = TextAlign.Center,
color = ElementTheme.materialColors.tertiary,
color = ElementTheme.colors.textSecondary,
modifier = Modifier.fillMaxWidth()
)
}

View file

@ -10,10 +10,10 @@ package io.element.android.libraries.designsystem.theme.components.previews
import androidx.compose.material3.AlertDialogDefaults
import androidx.compose.material3.DatePicker
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.rememberDatePickerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.architecture.coverage.ExcludeFromCoverage
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
@ -48,7 +48,7 @@ private fun ContentToPreview() {
shape = AlertDialogDefaults.shape,
containerColor = AlertDialogDefaults.containerColor,
tonalElevation = AlertDialogDefaults.TonalElevation,
buttonContentColor = MaterialTheme.colorScheme.primary,
buttonContentColor = ElementTheme.colors.textPrimary,
iconContentColor = AlertDialogDefaults.iconContentColor,
titleContentColor = AlertDialogDefaults.titleContentColor,
textContentColor = AlertDialogDefaults.textContentColor,

View file

@ -9,12 +9,12 @@ package io.element.android.libraries.designsystem.theme.components.previews
import androidx.compose.material3.AlertDialogDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TimePicker
import androidx.compose.material3.TimePickerLayoutType
import androidx.compose.material3.rememberTimePickerState
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
import io.element.android.libraries.designsystem.preview.ElementThemedPreview
@ -35,7 +35,7 @@ internal fun TimePickerHorizontalPreview() {
shape = AlertDialogDefaults.shape,
containerColor = AlertDialogDefaults.containerColor,
tonalElevation = AlertDialogDefaults.TonalElevation,
buttonContentColor = MaterialTheme.colorScheme.primary,
buttonContentColor = ElementTheme.colors.textPrimary,
iconContentColor = AlertDialogDefaults.iconContentColor,
titleContentColor = AlertDialogDefaults.titleContentColor,
textContentColor = AlertDialogDefaults.textContentColor,
@ -57,7 +57,7 @@ internal fun TimePickerVerticalLightPreview() {
shape = AlertDialogDefaults.shape,
containerColor = AlertDialogDefaults.containerColor,
tonalElevation = AlertDialogDefaults.TonalElevation,
buttonContentColor = MaterialTheme.colorScheme.primary,
buttonContentColor = ElementTheme.colors.textPrimary,
iconContentColor = AlertDialogDefaults.iconContentColor,
titleContentColor = AlertDialogDefaults.titleContentColor,
textContentColor = AlertDialogDefaults.textContentColor,
@ -83,7 +83,7 @@ internal fun TimePickerVerticalDarkPreview() {
shape = AlertDialogDefaults.shape,
containerColor = AlertDialogDefaults.containerColor,
tonalElevation = AlertDialogDefaults.TonalElevation,
buttonContentColor = MaterialTheme.colorScheme.primary,
buttonContentColor = ElementTheme.colors.textPrimary,
iconContentColor = AlertDialogDefaults.iconContentColor,
titleContentColor = AlertDialogDefaults.titleContentColor,
textContentColor = AlertDialogDefaults.textContentColor,

View file

@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
@ -97,7 +96,7 @@ private fun AvatarActionBottomSheetContent(
Text(
text = stringResource(action.titleResId),
style = ElementTheme.typography.fontBodyLgRegular,
color = if (action.destructive) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.primary,
color = if (action.destructive) ElementTheme.colors.textCriticalPrimary else ElementTheme.colors.textPrimary,
)
},
leadingContent = ListItemContent.Icon(IconSource.Resource(action.iconResourceId)),

View file

@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@ -27,6 +26,7 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.libraries.designsystem.components.avatar.Avatar
import io.element.android.libraries.designsystem.components.avatar.AvatarData
@ -79,7 +79,7 @@ fun EditableAvatarView(
modifier = Modifier
.align(Alignment.BottomEnd)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.primary)
.background(ElementTheme.colors.iconPrimary)
.size(24.dp),
contentAlignment = Alignment.Center,
) {
@ -87,7 +87,7 @@ fun EditableAvatarView(
modifier = Modifier.size(16.dp),
imageVector = CompoundIcons.EditSolid(),
contentDescription = null,
tint = MaterialTheme.colorScheme.onPrimary,
tint = ElementTheme.colors.iconOnSolidPrimary,
)
}
}

View file

@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
@ -40,7 +39,7 @@ fun InviteSenderView(
Text(
text = inviteSender.annotatedString(),
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
}
}

View file

@ -77,14 +77,14 @@ private fun MatrixUserHeaderContent(
maxLines = 1,
style = ElementTheme.typography.fontHeadingSmMedium,
overflow = TextOverflow.Ellipsis,
color = ElementTheme.materialColors.primary,
color = ElementTheme.colors.textPrimary,
)
// Id
if (matrixUser.displayName.isNullOrEmpty().not()) {
Text(
text = matrixUser.userId.value,
style = ElementTheme.typography.fontBodyMdRegular,
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)

View file

@ -26,6 +26,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.designsystem.components.avatar.CompositeAvatar
@ -65,21 +66,21 @@ fun SelectedRoom(
)
}
Surface(
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.iconPrimary,
modifier = Modifier
.clip(CircleShape)
.size(20.dp)
.align(Alignment.TopEnd)
.clickable(
indication = ripple(),
interactionSource = remember { MutableInteractionSource() },
onClick = { onRemoveRoom(roomInfo) }
),
.clip(CircleShape)
.size(20.dp)
.align(Alignment.TopEnd)
.clickable(
indication = ripple(),
interactionSource = remember { MutableInteractionSource() },
onClick = { onRemoveRoom(roomInfo) }
),
) {
Icon(
imageVector = CompoundIcons.Close(),
contentDescription = stringResource(id = CommonStrings.action_remove),
tint = MaterialTheme.colorScheme.onPrimary,
tint = ElementTheme.colors.iconOnSolidPrimary,
modifier = Modifier.padding(2.dp)
)
}

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -58,7 +57,7 @@ fun UnresolvedUserRow(
text = id,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyLgMedium,
)
@ -75,12 +74,11 @@ fun UnresolvedUserRow(
.size(18.dp)
.align(Alignment.Top)
.padding(2.dp),
tint = MaterialTheme.colorScheme.error,
tint = ElementTheme.colors.iconCriticalPrimary,
)
Text(
text = stringResource(CommonStrings.common_invite_unknown_profile),
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmRegular.copy(lineHeight = 16.sp),
)
}

View file

@ -67,7 +67,7 @@ fun UnsavedAvatar(
modifier = Modifier
.align(Alignment.Center)
.size(40.dp),
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
)
}
}

View file

@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -51,14 +50,14 @@ internal fun UserRow(
text = name,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyLgRegular,
)
// Id
subtext?.let {
Text(
text = subtext,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular,

View file

@ -140,7 +140,7 @@ private fun ReplyToErrorContent(
Text(
text = data.message,
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.error,
color = ElementTheme.colors.textCriticalPrimary,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)
@ -171,7 +171,7 @@ private fun ReplyToContentText(metadata: InReplyToMetadata?) {
if (iconResourceId != null) {
Icon(
resourceId = iconResourceId,
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
contentDescription = null,
modifier = Modifier.size(16.dp)
)
@ -182,7 +182,7 @@ private fun ReplyToContentText(metadata: InReplyToMetadata?) {
style = ElementTheme.typography.fontBodyMdRegular,
fontStyle = fontStyle,
textAlign = TextAlign.Start,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 2,
overflow = TextOverflow.Ellipsis,
)

View file

@ -10,7 +10,6 @@ package io.element.android.libraries.matrix.ui.messages.sender
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -77,7 +76,7 @@ private fun RowScope.MainText(
val color = when (mode) {
is SenderNameMode.Timeline -> mode.mainColor
SenderNameMode.ActionList,
SenderNameMode.Reply -> MaterialTheme.colorScheme.primary
SenderNameMode.Reply -> ElementTheme.colors.textPrimary
}
Text(
modifier = modifier.clipToBounds(),
@ -108,7 +107,7 @@ private fun RowScope.SecondaryText(
modifier = modifier.clipToBounds(),
text = text,
style = style,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)

View file

@ -7,7 +7,6 @@
package io.element.android.libraries.matrix.ui.model
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.platform.LocalContext
@ -15,6 +14,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontWeight
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.designsystem.components.avatar.AvatarData
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.matrix.api.core.UserId
@ -37,7 +37,7 @@ data class InviteSender(
AnnotatedString.Range(
SpanStyle(
fontWeight = FontWeight.Medium,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
),
start = senderNameStart,
end = senderNameStart + displayName.length

View file

@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@ -141,7 +140,7 @@ private fun MediaRow(
// Info
Text(
text = state.mediaInfo.mimeType + " - " + state.mediaInfo.formattedFileSize,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular,

View file

@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
@ -165,7 +164,7 @@ private fun SenderRow(
// Id
Text(
text = mediaInfo.senderId?.value.orEmpty(),
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular,

View file

@ -25,7 +25,6 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.GraphicEq
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
@ -261,13 +260,13 @@ private fun ExoPlayerMediaAudioView(
modifier = Modifier
.size(72.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.onBackground),
.background(ElementTheme.colors.iconPrimary),
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = Icons.Outlined.GraphicEq,
contentDescription = null,
tint = MaterialTheme.colorScheme.background,
tint = ElementTheme.colors.iconOnSolidPrimary,
modifier = Modifier
.size(32.dp),
)
@ -335,7 +334,7 @@ private fun AudioInfoView(
style = ElementTheme.typography.fontBodyMdRegular,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
)
}
if (info != null) {
@ -346,7 +345,7 @@ private fun AudioInfoView(
style = ElementTheme.typography.fontBodyLgRegular,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
)
Spacer(modifier = Modifier.height(4.dp))
Text(
@ -354,7 +353,7 @@ private fun AudioInfoView(
style = ElementTheme.typography.fontBodyMdRegular,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
)
}
}

View file

@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.GraphicEq
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@ -72,13 +71,13 @@ fun MediaFileView(
modifier = Modifier
.size(72.dp)
.clip(CircleShape)
.background(MaterialTheme.colorScheme.onBackground),
.background(ElementTheme.colors.iconPrimary),
contentAlignment = Alignment.Center,
) {
Icon(
imageVector = if (isAudio) Icons.Outlined.GraphicEq else CompoundIcons.Attachment(),
contentDescription = null,
tint = MaterialTheme.colorScheme.background,
tint = ElementTheme.colors.iconOnSolidPrimary,
modifier = Modifier
.size(32.dp)
.rotate(if (isAudio) 0f else -45f),
@ -92,7 +91,7 @@ fun MediaFileView(
style = ElementTheme.typography.fontBodyLgRegular,
overflow = TextOverflow.Ellipsis,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
)
Spacer(modifier = Modifier.height(4.dp))
Text(
@ -100,7 +99,7 @@ fun MediaFileView(
style = ElementTheme.typography.fontBodyMdRegular,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary
color = ElementTheme.colors.textPrimary
)
}
}

View file

@ -88,7 +88,7 @@ private fun EditingModeView(
Icon(
imageVector = CompoundIcons.Edit(),
contentDescription = null,
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.padding(vertical = 8.dp)
.size(16.dp),
@ -97,7 +97,7 @@ private fun EditingModeView(
text = text,
style = ElementTheme.typography.fontBodySmRegular,
textAlign = TextAlign.Start,
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
modifier = Modifier
.padding(vertical = 8.dp)
.weight(1f)
@ -105,7 +105,7 @@ private fun EditingModeView(
Icon(
imageVector = CompoundIcons.Close(),
contentDescription = stringResource(CommonStrings.action_close),
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.padding(top = 8.dp, bottom = 8.dp, start = 16.dp, end = 12.dp)
.size(16.dp)
@ -140,7 +140,7 @@ private fun ReplyToModeView(
Icon(
imageVector = CompoundIcons.Close(),
contentDescription = stringResource(CommonStrings.action_close),
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.padding(end = 4.dp, top = 4.dp, start = 8.dp, bottom = 16.dp)
.size(16.dp)

View file

@ -27,9 +27,9 @@ object ElementRichTextEditorStyle {
return baseStyle.copy(
text = baseStyle.text.copy(
color = if (hasFocus) {
ElementTheme.materialColors.primary
ElementTheme.colors.textPrimary
} else {
ElementTheme.materialColors.secondary
ElementTheme.colors.textSecondary
},
lineHeight = TextUnit.Unspecified,
includeFontPadding = true,

View file

@ -84,7 +84,7 @@ internal fun VoiceMessagePreview(
Text(
text = time.formatShort(),
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmMedium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,