Roman Sedaikin
4 years ago
committed by
GitHub
7 changed files with 147 additions and 22 deletions
@ -0,0 +1,9 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.ui.graphics.Color |
||||
|
||||
val green200 = Color(0xffa5d6a7) |
||||
val green500 = Color(0xff4caf50) |
||||
val green700 = Color(0xff388e3c) |
||||
|
||||
val teal200 = Color(0xff80deea) |
@ -0,0 +1,11 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape |
||||
import androidx.compose.material.Shapes |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
val shapes = Shapes( |
||||
small = RoundedCornerShape(4.dp), |
||||
medium = RoundedCornerShape(4.dp), |
||||
large = RoundedCornerShape(0.dp) |
||||
) |
@ -0,0 +1,47 @@
|
||||
package com.jetbrains.compose.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 |
||||
|
||||
private val DarkGreenColorPalette = darkColors( |
||||
primary = green200, |
||||
primaryVariant = green700, |
||||
secondary = teal200, |
||||
background = Color.Black, |
||||
surface = Color(74, 74, 74), |
||||
onPrimary = Color.Black, |
||||
onSecondary = Color.White, |
||||
onBackground = Color.White, |
||||
onSurface = Color.White, |
||||
error = Color.Red, |
||||
) |
||||
|
||||
private val LightGreenColorPalette = lightColors( |
||||
primary = green500, |
||||
primaryVariant = green700, |
||||
secondary = teal200, |
||||
background = Color.White, |
||||
surface = Color.White, |
||||
onPrimary = Color.White, |
||||
onSecondary = Color.Black, |
||||
onBackground = Color.Black, |
||||
onSurface = Color.Black |
||||
) |
||||
|
||||
@Composable |
||||
fun WidgetTheme( |
||||
darkTheme: Boolean = false, |
||||
content: @Composable() () -> Unit, |
||||
) { |
||||
val colors = if (darkTheme) DarkGreenColorPalette else LightGreenColorPalette |
||||
|
||||
MaterialTheme( |
||||
colors = colors, |
||||
typography = typography, |
||||
shapes = shapes, |
||||
content = content |
||||
) |
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.jetbrains.compose.theme |
||||
|
||||
import androidx.compose.material.Typography |
||||
import androidx.compose.ui.graphics.Color |
||||
import androidx.compose.ui.text.TextStyle |
||||
import androidx.compose.ui.text.font.FontFamily |
||||
import androidx.compose.ui.text.font.FontWeight |
||||
import androidx.compose.ui.unit.sp |
||||
|
||||
val typography = Typography( |
||||
body1 = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 16.sp |
||||
), |
||||
body2 = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 14.sp |
||||
), |
||||
button = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.W500, |
||||
fontSize = 14.sp |
||||
), |
||||
caption = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 12.sp, |
||||
), |
||||
subtitle1 = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 16.sp, |
||||
color = Color.Gray |
||||
), |
||||
subtitle2 = TextStyle( |
||||
fontFamily = FontFamily.Default, |
||||
fontWeight = FontWeight.Normal, |
||||
fontSize = 14.sp, |
||||
color = Color.Gray |
||||
), |
||||
) |
Loading…
Reference in new issue