Skip to content

Commit

Permalink
[#353] Remove unnecessary sample for themeColors, add sample for cust…
Browse files Browse the repository at this point in the history
…om TopAppBar background color
  • Loading branch information
luongvo committed Jan 11, 2023
1 parent 621421d commit cc91780
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import co.nimblehq.sample.compose.R
import co.nimblehq.sample.compose.ui.theme.AppTheme.colors
import co.nimblehq.sample.compose.ui.theme.ComposeTheme

@Composable
fun AppBar(@StringRes title: Int) {
TopAppBar(
title = { Text(text = stringResource(title)) }
title = { Text(text = stringResource(title)) },
backgroundColor = colors.topAppBarBackground
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@ package co.nimblehq.sample.compose.ui.theme

import androidx.compose.material.*
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color

/**
* Extend final [Colors] class to provide more custom app colors.
*/
data class AppColors(
val themeColors: Colors
val themeColors: Colors,

// Custom colors here
val topAppBarBackground: Color = GreenCitrus
)

internal val LightColorPalette = AppColors(
themeColors = lightColors(
primary = GreenCitrus,
secondary = GreenChristi
)
themeColors = lightColors()
)

internal val DarkColorPalette = AppColors(
themeColors = darkColors(
primary = GreenCitrus,
secondary = GreenChristi
)
themeColors = darkColors()
)

internal val LocalColors = staticCompositionLocalOf { LightColorPalette }
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package co.nimblehq.sample.compose.ui.theme

import androidx.compose.ui.graphics.Color

// Base colors here
internal val GreenCitrus = Color(0xFF99CC00)
internal val GreenChristi = Color(0xFF669900)

0 comments on commit cc91780

Please sign in to comment.