mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 16:27:06 +05:30
all: commonize theming
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
d63a331325
commit
090c3c2017
5 changed files with 38 additions and 24 deletions
|
@ -22,14 +22,26 @@ import androidx.compose.material.Text
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.google.accompanist.flowlayout.FlowRow
|
||||
import dev.msfjarvis.claw.common.theme.titleColor
|
||||
import dev.msfjarvis.lobsters.data.local.SavedPost
|
||||
import io.kamel.image.KamelImage
|
||||
import io.kamel.image.lazyImageResource
|
||||
|
||||
val TEST_POST =
|
||||
SavedPost(
|
||||
shortId = "zqyydb",
|
||||
title = "k2k20 hackathon report: Bob Beck on LibreSSL progress",
|
||||
url = "https://undeadly.org/cgi?action=article;sid=20200921105847",
|
||||
createdAt = "2020-09-21T07:11:14.000-05:00",
|
||||
commentsUrl = "https://lobste.rs/s/zqyydb/k2k20_hackathon_report_bob_beck_on",
|
||||
submitterName = "Vigdis",
|
||||
submitterAvatarUrl = "/404.html",
|
||||
tags = listOf("openbsd", "linux", "containers", "hack the planet", "no thanks"),
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun LobstersItem(
|
||||
post: SavedPost,
|
||||
|
@ -84,7 +96,7 @@ fun PostTitle(
|
|||
) {
|
||||
Text(
|
||||
text = title,
|
||||
color = Color.Black,
|
||||
color = titleColor,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier.then(modifier),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package dev.msfjarvis.claw.common.theme
|
||||
|
||||
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(darkTheme: Boolean, children: @Composable () -> Unit) {
|
||||
MaterialTheme(
|
||||
colors = if (darkTheme) darkColors else lightColors,
|
||||
content = children,
|
||||
)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue