Skip to content

Commit

Permalink
Adds color palette. (AdamMc331#35)
Browse files Browse the repository at this point in the history
* Adding color palette for AdamMc331#19.

* Updating stream-history.md for AdamMc331#19.
  • Loading branch information
AdamMc331 authored Sep 22, 2021
1 parent 700f334 commit a319c59
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
.externalNativeBuild
.cxx
local.properties
/.idea/deploymentTargetDropDown.xml
4 changes: 2 additions & 2 deletions app/src/main/java/com/adammcneilly/toa/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TOATheme {
TOATheme() {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
Greeting("Android")
Expand All @@ -32,7 +32,7 @@ fun Greeting(name: String) {
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
TOATheme {
TOATheme() {
Greeting("Android")
}
}
20 changes: 16 additions & 4 deletions app/src/main/java/com/adammcneilly/toa/ui/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,21 @@

package com.adammcneilly.toa.ui.theme

import androidx.compose.material.lightColors
import androidx.compose.ui.graphics.Color

val Purple200 = Color(0xFFBB86FC)
val Purple500 = Color(0xFF6200EE)
val Purple700 = Color(0xFF3700B3)
val Teal200 = Color(0xFF03DAC5)
private val PrimaryBlue = Color(0xFF0A3751)
private val SecondaryOrange = Color(0xFFFC8138)
private val BackgroundBlue = Color(0xFFF4F4F8)
private val OnBackgroundBlack = Color(0xFF282828)

val lightColorPalette = lightColors(
primary = PrimaryBlue,
onPrimary = Color.White,
secondary = SecondaryOrange,
onSecondary = Color.White,
background = BackgroundBlue,
onBackground = OnBackgroundBlack,
surface = Color.White,
onSurface = PrimaryBlue,
)
33 changes: 2 additions & 31 deletions app/src/main/java/com/adammcneilly/toa/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
package com.adammcneilly.toa.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.runtime.Composable

private val DarkColorPalette = darkColors(
primary = Purple200,
primaryVariant = Purple700,
secondary = Teal200
)

private val LightColorPalette = lightColors(
primary = Purple500,
primaryVariant = Purple700,
secondary = Teal200

/* Other default colors to override
background = Color.White,
surface = Color.White,
onPrimary = Color.White,
onSecondary = Color.Black,
onBackground = Color.Black,
onSurface = Color.Black,
*/
)

@Composable
fun TOATheme(
darkTheme: Boolean = isSystemInDarkTheme(),
content: @Composable() () -> Unit
content: @Composable () -> Unit,
) {
val colors = if (darkTheme) {
DarkColorPalette
} else {
LightColorPalette
}
val colors = lightColorPalette

MaterialTheme(
colors = colors,
Expand Down
11 changes: 10 additions & 1 deletion stream-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,13 @@ PRs:
* Danger: https://github.com/AdamMc331/TOA/pull/29
* Ktlint: https://github.com/AdamMc331/TOA/pull/30
* Detekt: https://github.com/AdamMc331/TOA/pull/31
* Git Hooks: https://github.com/AdamMc331/TOA/pull/32
* Git Hooks: https://github.com/AdamMc331/TOA/pull/32

## Stream Three - Design System

In this stream, we setup a design system for the application.

PRs:
* Colors:

Date: September 22, 2021

0 comments on commit a319c59

Please sign in to comment.