Skip to main content

Theming Guide

Miru SDK's UI components use a centralized theming system based on MiruTheme. Customize colors, typography, and component styles per project.

Setup​

Wrap your root composable in MiruTheme:

@Composable
fun App() {
MiruTheme(
colorScheme = MiruColorScheme(
primary = Color(0xFF1E88E5),
secondary = Color(0xFFFF6F00),
background = Color(0xFFFAFAFA),
surface = Color(0xFFFFFFFF),
error = Color(0xFFD32F2F),
onPrimary = Color.White,
onSecondary = Color.White,
onBackground = Color(0xFF212121),
onSurface = Color(0xFF212121),
onError = Color.White
),
typography = MiruTypography(
titleLarge = TextStyle(fontSize = 22.sp, fontWeight = FontWeight.Bold),
titleMedium = TextStyle(fontSize = 18.sp, fontWeight = FontWeight.SemiBold),
titleSmall = TextStyle(fontSize = 14.sp, fontWeight = FontWeight.Medium),
bodyLarge = TextStyle(fontSize = 16.sp),
bodyMedium = TextStyle(fontSize = 14.sp),
bodySmall = TextStyle(fontSize = 12.sp),
labelLarge = TextStyle(fontSize = 14.sp, fontWeight = FontWeight.Medium),
labelSmall = TextStyle(fontSize = 11.sp)
)
) {
AppNavigation()
}
}

Accessing Theme Values​

Inside any composable within the MiruTheme scope:

@Composable
fun MyComponent() {
Text(
text = "Hello",
color = MiruTheme.colorScheme.primary,
style = MiruTheme.typography.titleMedium
)

Box(
modifier = Modifier.background(MiruTheme.colorScheme.surface)
) {
// ...
}
}

Color Scheme​

PropertyUsage
primaryPrimary brand color — buttons, links, active states
secondarySecondary brand color — FABs, accents
backgroundPage/screen background
surfaceCard and dialog backgrounds
errorError states, validation messages
onPrimaryText/icon color on primary backgrounds
onSecondaryText/icon color on secondary backgrounds
onBackgroundText/icon color on background
onSurfaceText/icon color on surfaces
onErrorText/icon color on error backgrounds

Typography​

PropertyTypical Usage
titleLargeScreen titles, hero text
titleMediumSection headers, card titles
titleSmallSubsection headers
bodyLargePrimary body text
bodyMediumSecondary body text
bodySmallCaptions, timestamps
labelLargeButton text
labelSmallBadges, chips

Dark Mode​

Swap color schemes based on system preference:

@Composable
fun App() {
val isDark = isSystemInDarkTheme()

MiruTheme(
colorScheme = if (isDark) darkColorScheme else lightColorScheme
) {
AppNavigation()
}
}

val lightColorScheme = MiruColorScheme(
primary = Color(0xFF1E88E5),
background = Color(0xFFFAFAFA),
surface = Color.White,
// ...
)

val darkColorScheme = MiruColorScheme(
primary = Color(0xFF90CAF9),
background = Color(0xFF121212),
surface = Color(0xFF1E1E1E),
// ...
)

Component Styling​

All Miru components automatically inherit theme values. For example, MiruButton uses primary for its background and onPrimary for its text. MiruCard uses surface as its background and onSurface for content.

If you need per-component overrides, most components accept standard Compose Modifier and style parameters.