mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 14:37:04 +05:30
android: Add LobstersTheme
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
7864652610
commit
5b1403730e
2 changed files with 52 additions and 7 deletions
|
@ -3,6 +3,7 @@ package dev.msfjarvis.claw.android
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import dev.msfjarvis.claw.android.theme.LobstersTheme
|
||||||
import dev.msfjarvis.claw.common.posts.LobstersItem
|
import dev.msfjarvis.claw.common.posts.LobstersItem
|
||||||
import dev.msfjarvis.lobsters.data.local.SavedPost
|
import dev.msfjarvis.lobsters.data.local.SavedPost
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContent {
|
setContent {
|
||||||
|
LobstersTheme {
|
||||||
LobstersItem(
|
LobstersItem(
|
||||||
post = TEST_POST,
|
post = TEST_POST,
|
||||||
isSaved = false,
|
isSaved = false,
|
||||||
|
@ -32,3 +34,4 @@ class MainActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package dev.msfjarvis.claw.android.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
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val titleColor = Color(0xFF7395D9)
|
||||||
|
|
||||||
|
val lightColors =
|
||||||
|
lightColors(
|
||||||
|
primary = Color.White,
|
||||||
|
secondary = Color(0xFF6C0000),
|
||||||
|
background = Color.White,
|
||||||
|
surface = Color.White,
|
||||||
|
onPrimary = Color.DarkGray,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onBackground = Color.White,
|
||||||
|
onSurface = Color.White,
|
||||||
|
)
|
||||||
|
|
||||||
|
val darkColors =
|
||||||
|
darkColors(
|
||||||
|
primary = Color.White,
|
||||||
|
secondary = Color(0xFFD2362D),
|
||||||
|
background = Color.Black,
|
||||||
|
surface = Color.Black,
|
||||||
|
onPrimary = Color.Black,
|
||||||
|
onSecondary = Color.White,
|
||||||
|
onBackground = Color.White,
|
||||||
|
onSurface = Color.White,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LobstersTheme(children: @Composable () -> Unit) {
|
||||||
|
MaterialTheme(
|
||||||
|
colors = if (isSystemInDarkTheme()) darkColors else lightColors,
|
||||||
|
content = children,
|
||||||
|
)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue