-
Notifications
You must be signed in to change notification settings - Fork 0
Typography
Ghimpu Lucian Eduard edited this page May 25, 2022
·
2 revisions
All styles are Compose TextStyle stored in EverliTypography object:
@Composable
fun SomeText() {
Text(
text = "Hello",
color = EverliColors.Black100,
style = EverliTypography.Body.Regular
)
}Note EverlyTypography contains sub-objects for each style, e.g. EverlyTypography.Body
The styles are stored as xml styles in styles.xml:
<TextView
style="@style/EverliTypography.Body.Regular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"
android:textColor="@color/black_100" />Note: All styles are accessible via the EverliTypography prefix.
The typography styles are mirrored in:
data class EverliTypographyUsed then in EverliTheme for the local composition:
object EverliTheme {
val typography: EverliTypography
@Composable
@ReadOnlyComposable
get() = LocalTypography.current
// more code
}EverliTheme.typography.title for a "plus" sub-theme.
Unfortunately, text styles are not supported as part of the theme, they are only accessible via EverliTypography style mentioned above.
- First a new
TextStyleinEverliTypography - Then new XML style in
styles.xml - We also need to update
EverliTypographydata class used for the theme