Skip to content

Commit

Permalink
Revert "Implement light theme (#198)"
Browse files Browse the repository at this point in the history
This reverts commit a9a9131.
  • Loading branch information
AfigAliyev committed Jul 3, 2023
1 parent 0a3d3c1 commit 079672e
Show file tree
Hide file tree
Showing 36 changed files with 153 additions and 231 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ description of the modularization strategy used in
UI components are designed according to the custom design system and built entirely
using [Jetpack Compose](https://developer.android.com/jetpack/compose).

The app has a light and dark theme that uses predefined colors.
The app has one dark theme that uses predefined colors.

Find out more about the [UI architecture here](docs/ArchitectureLearningJourney.md#ui-layer).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ import com.maximillianleonov.cinemax.ui.component.CinemaxBottomBar
@OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class)
@Suppress("ModifierMissing")
@Composable
fun CinemaxApp(appState: CinemaxAppState = rememberCinemaxAppState()) {
CinemaxTheme {
val systemBarsColor = CinemaxTheme.colors.primary
LaunchedEffect(systemBarsColor) { appState.setSystemBarsColor(systemBarsColor) }
fun CinemaxApp(
appState: CinemaxAppState = rememberCinemaxAppState(),
systemBarsColor: Color = CinemaxTheme.colors.primaryDark
) {
LaunchedEffect(systemBarsColor) { appState.setSystemBarsColor(systemBarsColor) }

CinemaxTheme {
CompositionLocalProvider(
LocalSnackbarHostState provides appState.snackbarHostState
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fun CinemaxBottomBar(
currentDestination: TopLevelDestination,
onNavigateToDestination: (TopLevelDestination) -> Unit,
modifier: Modifier = Modifier,
color: Color = CinemaxTheme.colors.primary
color: Color = CinemaxTheme.colors.primaryDark
) {
Surface(
modifier = modifier,
Expand All @@ -91,9 +91,9 @@ fun CinemaxBottomBar(
val selected = destination == currentDestination
val tint by animateColorAsState(
if (selected) {
CinemaxTheme.colors.accent
CinemaxTheme.colors.primaryBlue
} else {
CinemaxTheme.colors.textSecondary
CinemaxTheme.colors.grey
}
)

Expand Down Expand Up @@ -286,7 +286,7 @@ private fun CinemaxBottomNavItemLayout(
private fun CinemaxBottomNavIndicator(
modifier: Modifier = Modifier,
padding: Dp = CinemaxTheme.spacing.smallMedium,
color: Color = CinemaxTheme.colors.primaryVariant,
color: Color = CinemaxTheme.colors.primarySoft,
shape: Shape = CinemaxTheme.shapes.medium
) {
Spacer(
Expand Down
25 changes: 0 additions & 25 deletions app/src/main/res/values-night/themes.xml

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
limitations under the License.
-->
<resources>
<color name="primaryLight">#DFD8FF</color>
<color name="primaryDark">#1F1D2B</color>
</resources>
8 changes: 4 additions & 4 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<resources xmlns:tools="http://schemas.android.com/tools">

<style name="Theme.Cinemax" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:statusBarColor">@color/primaryLight</item>
<item name="android:navigationBarColor">@color/primaryLight</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="27">true</item>
<item name="android:statusBarColor">@color/primaryDark</item>
<item name="android:navigationBarColor">@color/primaryDark</item>
<item name="android:windowLightStatusBar" tools:targetApi="23">false</item>
<item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>
</style>

<style name="Theme.Cinemax.Splash" parent="Theme.SplashScreen">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fun CinemaxOutlinedButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
shape: Shape = CinemaxTheme.shapes.medium,
containerColor: Color = CinemaxTheme.colors.primaryVariant,
contentColor: Color = CinemaxTheme.colors.accent,
containerColor: Color = CinemaxTheme.colors.primarySoft,
contentColor: Color = CinemaxTheme.colors.primaryBlue,
borderColor: Color = contentColor,
textStyle: TextStyle = CinemaxTheme.typography.medium.h5
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private fun SubcomposeAsyncImageScope.SubcomposeAsyncImageHandler() {
AsyncImagePainter.State.Empty, is AsyncImagePainter.State.Error -> Box(
modifier = Modifier
.fillMaxSize()
.background(CinemaxTheme.colors.primaryVariant)
.background(CinemaxTheme.colors.primarySoft)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun CinemaxMessage(
Text(
text = stringResource(id = messageResourceId),
style = CinemaxTheme.typography.medium.h3,
color = CinemaxTheme.colors.textPrimary,
color = CinemaxTheme.colors.white,
textAlign = TextAlign.Center
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.maximillianleonov.cinemax.core.designsystem.theme.CinemaxTheme
@Composable
fun CinemaxImagePlaceholder(
modifier: Modifier = Modifier,
color: Color = CinemaxTheme.colors.primaryVariant
color: Color = CinemaxTheme.colors.primarySoft
) {
Box(
modifier = modifier
Expand All @@ -38,7 +38,7 @@ fun CinemaxImagePlaceholder(
}

fun Modifier.cinemaxPlaceholder() = composed {
cinemaxPlaceholder(color = CinemaxTheme.colors.primaryVariant)
cinemaxPlaceholder(color = CinemaxTheme.colors.primarySoft)
}

fun Modifier.cinemaxPlaceholder(color: Color) = composed {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import com.maximillianleonov.cinemax.core.designsystem.theme.CinemaxTheme
@Composable
fun CinemaxCircularProgressIndicator(
modifier: Modifier = Modifier,
color: Color = CinemaxTheme.colors.accent,
color: Color = CinemaxTheme.colors.primaryBlue,
strokeWidth: Dp = StrokeWidth
) {
CircularProgressIndicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ fun CinemaxSnackbarHost(
snackbarHostState: SnackbarHostState,
modifier: Modifier = Modifier,
shape: Shape = CinemaxTheme.shapes.small,
containerColor: Color = CinemaxTheme.colors.primaryVariant,
contentColor: Color = CinemaxTheme.colors.textPrimaryVariant,
actionColor: Color = CinemaxTheme.colors.accent
containerColor: Color = CinemaxTheme.colors.primarySoft,
contentColor: Color = CinemaxTheme.colors.whiteGrey,
actionColor: Color = CinemaxTheme.colors.primaryBlue
) {
SnackbarHost(
hostState = snackbarHostState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ fun CinemaxSwipeRefresh(
isRefreshing: Boolean,
onRefresh: () -> Unit,
modifier: Modifier = Modifier,
backgroundColor: Color = CinemaxTheme.colors.primaryVariant,
contentColor: Color = CinemaxTheme.colors.accent,
backgroundColor: Color = CinemaxTheme.colors.primarySoft,
contentColor: Color = CinemaxTheme.colors.primaryBlue,
indicatorPadding: PaddingValues = PaddingValues(0.dp),
indicatorAlignment: Alignment = Alignment.TopCenter,
scale: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,20 @@ fun CinemaxTextField(
singleLine: Boolean = true,
shape: Shape = CinemaxTheme.shapes.extraMedium,
colors: TextFieldColors = TextFieldDefaults.textFieldColors(
textColor = CinemaxTheme.colors.textPrimary,
cursorColor = CinemaxTheme.colors.accent,
textColor = CinemaxTheme.colors.white,
cursorColor = CinemaxTheme.colors.primaryBlue,
selectionColors = TextSelectionColors(
handleColor = CinemaxTheme.colors.accent,
backgroundColor = CinemaxTheme.colors.accent.copy(
handleColor = CinemaxTheme.colors.primaryBlue,
backgroundColor = CinemaxTheme.colors.primaryBlue.copy(
alpha = TextSelectionColorsBackgroundColorAlpha
)
),
containerColor = CinemaxTheme.colors.primaryVariant,
focusedLeadingIconColor = CinemaxTheme.colors.textSecondary,
unfocusedLeadingIconColor = CinemaxTheme.colors.textSecondary,
focusedTrailingIconColor = CinemaxTheme.colors.textSecondary,
unfocusedTrailingIconColor = CinemaxTheme.colors.textSecondary,
placeholderColor = CinemaxTheme.colors.textSecondary,
containerColor = CinemaxTheme.colors.primarySoft,
focusedLeadingIconColor = CinemaxTheme.colors.grey,
unfocusedLeadingIconColor = CinemaxTheme.colors.grey,
focusedTrailingIconColor = CinemaxTheme.colors.grey,
unfocusedTrailingIconColor = CinemaxTheme.colors.grey,
placeholderColor = CinemaxTheme.colors.grey,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ fun CinemaxTopAppBar(
actions: @Composable RowScope.() -> Unit = {},
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
colors: TopAppBarColors = TopAppBarDefaults.centerAlignedTopAppBarColors(
containerColor = CinemaxTheme.colors.primary,
titleContentColor = CinemaxTheme.colors.textPrimary,
navigationIconContentColor = CinemaxTheme.colors.textPrimary
containerColor = CinemaxTheme.colors.primaryDark,
titleContentColor = CinemaxTheme.colors.white,
navigationIconContentColor = CinemaxTheme.colors.white
)
) {
CenterAlignedTopAppBar(
Expand Down Expand Up @@ -70,7 +70,7 @@ fun CinemaxTopAppBar(
Text(
text = stringResource(id = titleResourceId),
style = CinemaxTheme.typography.semiBold.h4,
color = CinemaxTheme.colors.textPrimary,
color = CinemaxTheme.colors.white,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,94 +17,45 @@
package com.maximillianleonov.cinemax.core.designsystem.theme

import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color

private val LightPrimary = Color(0xFFDFD8FF)
private val LightPrimaryVariant = Color(0xFFD1C4E9)
private val LightAccent = Color(0xFF441EEC)
private val LightSecondary = Color(0xFF00993F)
private val LightSecondaryVariant = Color(0xFFE06000)
private val LightError = Color(0xFFB80000)
private val LightTextPrimary = Color(0xFF0E0D0D)
private val LightTextPrimaryVariant = Color(0xFF272727)
private val LightTextSecondary = Color(0xFF4F4F53)

private val DarkPrimary = Color(0xFF1F1D2B)
private val DarkPrimaryVariant = Color(0xFF252836)
private val DarkAccent = Color(0xFF12CDD9)
private val DarkSecondary = Color(0xFF22B07D)
private val DarkSecondaryVariant = Color(0xFFFF8700)
private val DarkError = Color(0xFFFB4141)
private val DarkTextPrimary = Color(0xFFFFFBFF)
private val DarkTextPrimaryVariant = Color(0xFFEBEBEF)
private val DarkTextSecondary = Color(0xFF92929D)

private val TextOnMedia = Color(0xFFFFFBFF)
private val TextOnMediaVariant = Color(0xFFEBEBEF)

internal val LightColorScheme = lightColorScheme(
primary = LightPrimary,
secondary = LightPrimaryVariant,
background = LightPrimary,
surface = LightPrimary
)
private val Dark = Color(0xFF1F1D2B)
private val Soft = Color(0xFF252836)
private val BlueAccent = Color(0xFF12CDD9)
private val Green = Color(0xFF22B07D)
private val Orange = Color(0xFFFF8700)
private val Red = Color(0xFFFB4141)
private val Black = Color(0xFF171725)
private val Grey = Color(0xFF92929D)
private val DarkGrey = Color(0xFF696974)
private val White = Color(0xFFFFFFFF)
private val WhiteGrey = Color(0xFFEBEBEF)
private val LineDark = Color(0xFFEAEAEA)

internal val DarkColorScheme = darkColorScheme(
primary = DarkPrimary,
secondary = DarkPrimaryVariant,
background = DarkPrimary,
surface = DarkPrimary
primary = Dark,
secondary = Soft,
background = Dark,
surface = Dark
)

@Immutable
data class CinemaxColors(
val default: Color = Color.Unspecified,
val primary: Color,
val primaryVariant: Color,
val accent: Color,
val secondary: Color,
val secondaryVariant: Color,
val error: Color,
val textPrimary: Color,
val textPrimaryVariant: Color,
val textSecondary: Color,
val textOnMedia: Color,
val textOnMediaVariant: Color
val primaryDark: Color = Dark,
val primarySoft: Color = Soft,
val primaryBlue: Color = BlueAccent,
val secondaryGreen: Color = Green,
val secondaryOrange: Color = Orange,
val secondaryRed: Color = Red,
val white: Color = White,
val whiteGrey: Color = WhiteGrey,
val black: Color = Black,
val grey: Color = Grey,
val darkGrey: Color = DarkGrey,
val lineDark: Color = LineDark
)

internal val LightCinemaxColors = CinemaxColors(
primary = LightPrimary,
primaryVariant = LightPrimaryVariant,
accent = LightAccent,
secondary = LightSecondary,
secondaryVariant = LightSecondaryVariant,
error = LightError,
textPrimary = LightTextPrimary,
textPrimaryVariant = LightTextPrimaryVariant,
textSecondary = LightTextSecondary,
textOnMedia = TextOnMedia,
textOnMediaVariant = TextOnMediaVariant
)

internal val DarkCinemaxColors = CinemaxColors(
primary = DarkPrimary,
primaryVariant = DarkPrimaryVariant,
accent = DarkAccent,
secondary = DarkSecondary,
secondaryVariant = DarkSecondaryVariant,
error = DarkError,
textPrimary = DarkTextPrimary,
textPrimaryVariant = DarkTextPrimaryVariant,
textSecondary = DarkTextSecondary,
textOnMedia = TextOnMedia,
textOnMediaVariant = TextOnMediaVariant
)

internal val LocalCinemaxColors = staticCompositionLocalOf<CinemaxColors> {
error(LocalCinemaxColorsErrorMessage)
}

private const val LocalCinemaxColorsErrorMessage = "No CinemaxColors provided."
internal val LocalCinemaxColors = staticCompositionLocalOf { CinemaxColors() }
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ internal fun rememberCinemaxRipple(
color: Color = RippleColor
) = rememberRipple(bounded = bounded, radius = radius, color = color)

private val RippleColor @Composable get() = CinemaxTheme.colors.accent
private val RippleColor: Color
@Composable get() = CinemaxTheme.colors.primaryBlue

private val RippleAlpha = RippleAlpha(
draggedAlpha = 0.16f,
Expand Down
Loading

0 comments on commit 079672e

Please sign in to comment.