-
-
Save llama-0/99f58df22ae9dbb8adb55dea410136c0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.llama.core.presentation.theme | |
import androidx.compose.material.Typography | |
import androidx.compose.runtime.Immutable | |
import androidx.compose.ui.text.TextStyle | |
import androidx.compose.ui.text.font.Font | |
import androidx.compose.ui.text.font.FontFamily | |
import androidx.compose.ui.text.font.FontWeight | |
import androidx.compose.ui.unit.sp | |
import ru.llama.core.R | |
@Immutable | |
data class AppTypography( | |
val materialTypography: Typography, | |
val appTitle: TextStyle, | |
val welcomeMessage: TextStyle, | |
val h1: TextStyle, | |
val body1Medium: TextStyle, | |
val body1Regular: TextStyle, | |
val body1Bold: TextStyle, | |
val body2Medium: TextStyle, | |
val body2Regular: TextStyle, | |
val button: TextStyle, | |
val caption: TextStyle, | |
val overline: TextStyle, | |
) | |
fun defaultAppTypography(): AppTypography = | |
appTypography(TextStyles(defaultAppColors())) | |
fun appTypography(style: TextStyles): AppTypography = | |
AppTypography( | |
materialTypography = Typography(), | |
appTitle = style.headline, | |
welcomeMessage = style.headline2, | |
h1 = style.headline1, | |
body1Medium = style.body1Medium, | |
body1Regular = style.body1Regular, | |
body1Bold = style.body1Bold, | |
body2Medium = style.body2Medium, | |
body2Regular = style.body2Regular, | |
button = style.button, | |
caption = style.caption, | |
overline = style.overLine, | |
) | |
class TextStyles(val colors: AppColors) { | |
val headline = TextStyle( | |
fontFamily = FontFamily( | |
Font(R.font.custom_sans_text_bold, FontWeight.Bold) | |
), | |
fontWeight = FontWeight.Bold, | |
fontSize = 32.sp, | |
letterSpacing = (-1.22).sp, | |
color = colors.onSurface | |
) | |
val headline2 = TextStyle( | |
fontFamily = FontFamily( | |
Font(R.font.custom_sans_text_bold, FontWeight.Bold) | |
), | |
fontWeight = FontWeight.Bold, | |
fontSize = 24.sp, | |
letterSpacing = (-0.54).sp, | |
) | |
val headline1 = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Medium, | |
fontSize = 20.sp, | |
letterSpacing = 0.17.sp, | |
) | |
val body1Medium = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Medium, | |
fontSize = 16.sp, | |
letterSpacing = 0.17.sp, | |
) | |
val body1Regular = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Normal, | |
fontSize = 16.sp, | |
letterSpacing = 0.17.sp, | |
) | |
val body1Bold = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Bold, | |
fontSize = 11.sp, | |
letterSpacing = 3.sp, | |
) | |
val body2Medium = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Medium, | |
fontSize = 14.sp, | |
letterSpacing = 0.02.sp, | |
) | |
val body2Regular = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Normal, | |
fontSize = 14.sp, | |
letterSpacing = 0.35.sp, | |
) | |
val overLine = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Normal, | |
fontSize = 14.sp, | |
letterSpacing = 0.08.sp, | |
) | |
val caption = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Normal, | |
fontSize = 12.sp, | |
letterSpacing = 0.12.sp, | |
) | |
val button = TextStyle( | |
fontFamily = FontFamily.SansSerif, | |
fontWeight = FontWeight.Medium, | |
fontSize = 14.sp, | |
letterSpacing = 1.5.sp, | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment