Skip to content

Commit

Permalink
Tweak SC themes a bit
Browse files Browse the repository at this point in the history
- SC light theme tertiary color text was a bit pale, e.g.
  for room topics
- SC light theme space bar wasn't separating itself by background color
- SC dark "you do not have permission to post to this room" colors

Change-Id: I3bafe475612c953cea1eb0baf03436f2d515e2b4
  • Loading branch information
SpiritCroc committed Oct 12, 2024
1 parent 3f73eef commit b974956
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import chat.schildi.lib.preferences.ScPrefs
import chat.schildi.lib.preferences.value
import chat.schildi.theme.ScTheme
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.messages.impl.actionlist.ActionListEvents
Expand Down Expand Up @@ -586,14 +587,14 @@ private fun CantSendMessageBanner() {
Row(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.secondary)
.background(ScTheme.exposures.composerBlockBg ?: MaterialTheme.colorScheme.secondary)
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
Text(
text = stringResource(id = R.string.screen_room_timeline_no_permission_to_post),
color = MaterialTheme.colorScheme.onSecondary,
color = ScTheme.exposures.composerBlockFg ?: MaterialTheme.colorScheme.onSecondary,
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Center,
fontStyle = FontStyle.Italic,
Expand Down
2 changes: 2 additions & 0 deletions schildi/theme/src/main/kotlin/chat/schildi/theme/ScDark.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ internal val scdExposures = ScThemeExposures(
greenFg = ScColors.colorAccentGreen,
greenBg = ScColors.colorAccentGreenAlpha_30,
messageHighlightBg = ScColors.colorAccentGreenAlpha_80,
composerBlockBg = scd_bgFloating,
composerBlockFg = scd_fgPrimary,
)

@OptIn(CoreColorToken::class)
Expand Down
6 changes: 4 additions & 2 deletions schildi/theme/src/main/kotlin/chat/schildi/theme/ScLight.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ internal val sclMaterialColorScheme = lightColorScheme(

secondary = scl_fgSecondary,
onSecondary = scd_fgPrimary,
secondaryContainer = scl_bg,
secondaryContainer = scl_bgBlack,
onSecondaryContainer = scl_fgSecondary,

tertiary = scl_fgTertiary,
tertiary = scl_fgSecondary,
onTertiary = scl_fgTertiary,
tertiaryContainer = scl_bgBlack,
onTertiaryContainer = scl_fgTertiary,
Expand Down Expand Up @@ -76,6 +76,8 @@ internal val sclExposures = ScThemeExposures(
greenFg = ScColors.colorAccentGreen,
greenBg = ScColors.colorAccentGreenAlpha_21,
messageHighlightBg = ScColors.colorAccentGreenAlpha_80,
composerBlockBg = null,
composerBlockFg = null,
)

@OptIn(CoreColorToken::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ScThemeExposures(
greenFg: Color?,
greenBg: Color?,
messageHighlightBg: Color?,
composerBlockBg: Color?,
composerBlockFg: Color?,
) {
var isScTheme by mutableStateOf(isScTheme)
private set
Expand Down Expand Up @@ -71,6 +73,10 @@ class ScThemeExposures(
private set
var messageHighlightBg by mutableStateOf(messageHighlightBg)
private set
var composerBlockBg by mutableStateOf(composerBlockBg)
private set
var composerBlockFg by mutableStateOf(composerBlockFg)
private set

fun copy(
isScTheme: Boolean = this.isScTheme,
Expand All @@ -92,6 +98,8 @@ class ScThemeExposures(
greenFg: Color? = this.greenFg,
greenBg: Color? = this.greenBg,
messageHighlightBg: Color? = this.messageHighlightBg,
composerBlockBg: Color? = this.composerBlockBg,
composerBlockFg: Color? = this.composerBlockFg,
) = ScThemeExposures(
isScTheme = isScTheme,
horizontalDividerThickness = horizontalDividerThickness,
Expand All @@ -112,6 +120,8 @@ class ScThemeExposures(
greenFg = greenFg,
greenBg = greenBg,
messageHighlightBg = messageHighlightBg,
composerBlockBg = composerBlockBg,
composerBlockFg = composerBlockFg,
)

fun updateColorsFrom(other: ScThemeExposures) {
Expand All @@ -134,6 +144,8 @@ class ScThemeExposures(
greenFg = other.greenFg
greenBg = other.greenBg
messageHighlightBg = other.messageHighlightBg
composerBlockBg = other.composerBlockBg
composerBlockFg = other.composerBlockFg
}
}

Expand All @@ -157,6 +169,8 @@ internal val elementLightScExposures = ScThemeExposures(
greenFg = null,
greenBg = null,
messageHighlightBg = null,
composerBlockBg = null,
composerBlockFg = null,
)

internal val elementDarkScExposures = ScThemeExposures(
Expand All @@ -179,4 +193,6 @@ internal val elementDarkScExposures = ScThemeExposures(
greenFg = null,
greenBg = null,
messageHighlightBg = null,
composerBlockBg = null,
composerBlockFg = null,
)

0 comments on commit b974956

Please sign in to comment.