Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

feat(ui): bundle Inter font + design tokens + theme with dynamic-color toggle

ExTvb9cc6827446e
diff --git a/app/src/main/assets/ui-fonts/Inter-Regular.ttf b/app/src/main/assets/ui-fonts/Inter-Regular.ttf
new file mode 100644
index 0000000..c544be4
Binary files /dev/null and b/app/src/main/assets/ui-fonts/Inter-Regular.ttf differ
diff --git a/app/src/main/assets/ui-fonts/Inter-SemiBold.ttf b/app/src/main/assets/ui-fonts/Inter-SemiBold.ttf
new file mode 100644
index 0000000..a32e2b8
Binary files /dev/null and b/app/src/main/assets/ui-fonts/Inter-SemiBold.ttf differ
diff --git a/app/src/main/java/com/excp/podroid/MainActivity.kt b/app/src/main/java/com/excp/podroid/MainActivity.kt
index 7864708..123c16f 100644
--- a/app/src/main/java/com/excp/podroid/MainActivity.kt
+++ b/app/src/main/java/com/excp/podroid/MainActivity.kt
@@ -29,7 +29,8 @@ class MainActivity : ComponentActivity() {
val windowSizeClass = calculateWindowSizeClass(this)
val navVm: NavGraphViewModel = hiltViewModel()
val darkTheme by navVm.darkTheme.collectAsStateWithLifecycle(initialValue = null)
- PodroidTheme(darkTheme = darkTheme) {
+ val dynamicColor by navVm.dynamicColorEnabled.collectAsStateWithLifecycle(initialValue = false)
+ PodroidTheme(darkTheme = darkTheme, dynamicColor = dynamicColor) {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
diff --git a/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt b/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
index 89b8918..3e311eb 100644
--- a/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
+++ b/app/src/main/java/com/excp/podroid/data/repository/SettingsRepository.kt
@@ -43,6 +43,7 @@ class SettingsRepository @Inject constructor(
val KEY_KERNEL_EXTRA_CMDLINE = stringPreferencesKey("kernel_extra_cmdline")
val KEY_SHOW_EXTRA_KEYS = booleanPreferencesKey("show_extra_keys")
val KEY_HAPTICS_ENABLED = booleanPreferencesKey("haptics_enabled")
+ val KEY_DYNAMIC_COLOR_ENABLED = booleanPreferencesKey("dynamic_color_enabled")
/**
* Default tunable QEMU args — CPU model, accel tuning, RNG source, overcommit.
@@ -98,6 +99,7 @@ class SettingsRepository @Inject constructor(
val kernelExtraCmdline = pref(KEY_KERNEL_EXTRA_CMDLINE, DEFAULT_KERNEL_EXTRA_CMDLINE)
val showExtraKeys = pref(KEY_SHOW_EXTRA_KEYS, true)
val hapticsEnabled = pref(KEY_HAPTICS_ENABLED, true)
+ val dynamicColorEnabled = pref(KEY_DYNAMIC_COLOR_ENABLED, false)
suspend fun setDarkTheme(value: Boolean) = set(KEY_DARK_THEME, value)
suspend fun setVmRamMb(value: Int) = set(KEY_VM_RAM, value)
@@ -113,6 +115,7 @@ class SettingsRepository @Inject constructor(
suspend fun setKernelExtraCmdline(value: String) = set(KEY_KERNEL_EXTRA_CMDLINE, value)
suspend fun setShowExtraKeys(value: Boolean) = set(KEY_SHOW_EXTRA_KEYS, value)
suspend fun setHapticsEnabled(value: Boolean) = set(KEY_HAPTICS_ENABLED, value)
+ suspend fun setDynamicColorEnabled(value: Boolean) = set(KEY_DYNAMIC_COLOR_ENABLED, value)
// Snapshots used by non-Compose call sites (PodroidService, exporters).
suspend fun getSshEnabledSnapshot() = sshEnabled.first()
diff --git a/app/src/main/java/com/excp/podroid/ui/navigation/NavGraphViewModel.kt b/app/src/main/java/com/excp/podroid/ui/navigation/NavGraphViewModel.kt
index cc777ae..edf39aa 100644
--- a/app/src/main/java/com/excp/podroid/ui/navigation/NavGraphViewModel.kt
+++ b/app/src/main/java/com/excp/podroid/ui/navigation/NavGraphViewModel.kt
@@ -12,4 +12,5 @@ class NavGraphViewModel @Inject constructor(
) : ViewModel() {
val isSetupDone = settingsRepository.isSetupDone
val darkTheme = settingsRepository.darkTheme
+ val dynamicColorEnabled = settingsRepository.dynamicColorEnabled
}
diff --git a/app/src/main/java/com/excp/podroid/ui/theme/Color.kt b/app/src/main/java/com/excp/podroid/ui/theme/Color.kt
index 169006b..923b1f9 100644
--- a/app/src/main/java/com/excp/podroid/ui/theme/Color.kt
+++ b/app/src/main/java/com/excp/podroid/ui/theme/Color.kt
@@ -1,20 +1,38 @@
-/*
- * Podroid
- * Copyright (C) 2024-2026 Podroid contributors
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
package com.excp.podroid.ui.theme
import androidx.compose.ui.graphics.Color
-val Purple80 = Color(0xFFD0BCFF)
-val PurpleGrey80 = Color(0xFFCCC2DC)
-val Cyan80 = Color(0xFF80DEEA)
+// Legacy Material You fallback — kept for runtime compat with screens that
+// still reference the old constants. Safe to drop once Task 12 (Settings)
+// lands and no screen-level code references them.
+val Purple80 = Color(0xFFD0BCFF)
+val PurpleGrey80 = Color(0xFFCCC2DC)
+val Cyan80 = Color(0xFF80DEEA)
+val Purple40 = Color(0xFF6650A4)
+val PurpleGrey40 = Color(0xFF625B71)
+val Cyan40 = Color(0xFF00838F)
-val Purple40 = Color(0xFF6650A4)
-val PurpleGrey40 = Color(0xFF625B71)
-val Cyan40 = Color(0xFF00838F)
+// ── Podroid "Server console" palette ──────────────────────────────────────────
+// Dark
+val PodroidDarkBg = Color(0xFF0A0A0A)
+val PodroidDarkSurface = Color(0xFF141414)
+val PodroidDarkSurface2 = Color(0xFF1A1A1A)
+val PodroidDarkBorder = Color(0xFF262626)
+val PodroidDarkText = Color(0xFFEDEDED)
+val PodroidDarkTextMute = Color(0xFFA3A3A3)
+val PodroidDarkTextFaint = Color(0xFF737373)
+
+// Light
+val PodroidLightBg = Color(0xFFFAFAFA)
+val PodroidLightSurface = Color(0xFFFFFFFF)
+val PodroidLightSurface2 = Color(0xFFF4F4F5)
+val PodroidLightBorder = Color(0xFFE4E4E7)
+val PodroidLightText = Color(0xFF0A0A0A)
+val PodroidLightTextMute = Color(0xFF525252)
+val PodroidLightTextFaint = Color(0xFF737373)
+
+// Accent (mode-invariant)
+val PodroidAccent = Color(0xFF4ADE80)
+val PodroidAccentInk = Color(0xFF052E16)
+val PodroidAmber = Color(0xFFF59E0B)
+val PodroidRed = Color(0xFFEF4444)
diff --git a/app/src/main/java/com/excp/podroid/ui/theme/PodroidTokens.kt b/app/src/main/java/com/excp/podroid/ui/theme/PodroidTokens.kt
new file mode 100644
index 0000000..0fd13d3
--- /dev/null
+++ b/app/src/main/java/com/excp/podroid/ui/theme/PodroidTokens.kt
@@ -0,0 +1,100 @@
+/*
+ * Single source of truth for Podroid design tokens. Theme.kt maps these into
+ * Material colorScheme; screens consume colors via MaterialTheme.colorScheme.*
+ * and consume the non-color tokens (spacing, fonts, radii) directly from here.
+ */
+package com.excp.podroid.ui.theme
+
+import android.content.Context
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.ReadOnlyComposable
+import androidx.compose.ui.platform.LocalContext
+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.dp
+import androidx.compose.ui.unit.sp
+import java.io.File
+import java.io.FileOutputStream
+
+object PodroidTokens {
+
+ object Spacing {
+ val XS = 4.dp
+ val SM = 8.dp
+ val MD = 12.dp
+ val LG = 16.dp
+ val XL = 20.dp
+ val XL2 = 24.dp
+ val XL3 = 32.dp
+ val XL4 = 40.dp
+ }
+
+ object Radius {
+ val Chip = 4.dp
+ val Button = 8.dp
+ val Card = 12.dp
+ val Sheet = 20.dp
+ val Large = 24.dp
+ }
+
+ object TypeSize {
+ val Display = 32.sp
+ val Headline = 20.sp
+ val Title = 14.sp
+ val Body = 12.sp
+ val Mono = 11.sp
+ val Label = 10.sp
+ }
+
+ val Accent = PodroidAccent
+ val AccentInk = PodroidAccentInk
+ val Amber = PodroidAmber
+ val Red = PodroidRed
+
+ @Volatile private var interFamily: FontFamily? = null
+
+ fun interFamily(context: Context): FontFamily {
+ interFamily?.let { return it }
+ synchronized(this) {
+ interFamily?.let { return it }
+ val regular = extractAsset(context, "ui-fonts/Inter-Regular.ttf")
+ val semiBold = extractAsset(context, "ui-fonts/Inter-SemiBold.ttf")
+ val fam = FontFamily(
+ Font(regular, FontWeight.Normal),
+ Font(semiBold, FontWeight.SemiBold),
+ )
+ interFamily = fam
+ return fam
+ }
+ }
+
+ @Volatile private var monoFamily: FontFamily? = null
+
+ fun monoFamily(context: Context): FontFamily {
+ monoFamily?.let { return it }
+ synchronized(this) {
+ monoFamily?.let { return it }
+ val mono = extractAsset(context, "fonts/JetBrains-Mono.ttf")
+ val fam = FontFamily(Font(mono, FontWeight.Normal))
+ monoFamily = fam
+ return fam
+ }
+ }
+
+ @Composable @ReadOnlyComposable
+ fun ui(): FontFamily = interFamily(LocalContext.current)
+
+ @Composable @ReadOnlyComposable
+ fun mono(): FontFamily = monoFamily(LocalContext.current)
+
+ private fun extractAsset(context: Context, assetPath: String): File {
+ val outFile = File(context.filesDir, assetPath)
+ if (outFile.exists() && outFile.length() > 0) return outFile
+ outFile.parentFile?.mkdirs()
+ context.assets.open(assetPath).use { input ->
+ FileOutputStream(outFile).use { output -> input.copyTo(output) }
+ }
+ return outFile
+ }
+}
diff --git a/app/src/main/java/com/excp/podroid/ui/theme/Theme.kt b/app/src/main/java/com/excp/podroid/ui/theme/Theme.kt
index b7fab1f..2a5094f 100644
--- a/app/src/main/java/com/excp/podroid/ui/theme/Theme.kt
+++ b/app/src/main/java/com/excp/podroid/ui/theme/Theme.kt
@@ -1,8 +1,10 @@
/*
- * Podroid - Rootless Podman for Android
- * Copyright (C) 2024-2026 Podroid contributors
+ * Podroid Compose theme.
*
- * Material You theme for Podroid.
+ * Default identity: fixed dark/light palette derived from PodroidTokens, with
+ * a lime-green accent (#4ade80). Material You wallpaper-derived dynamic color
+ * is OFF by default — users opt in via Settings → Appearance → Dynamic color,
+ * which flows in via the dynamicColor parameter.
*/
package com.excp.podroid.ui.theme
@@ -16,37 +18,87 @@ import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
-private val DarkColorScheme = darkColorScheme(
- primary = Purple80,
- secondary = PurpleGrey80,
- tertiary = Cyan80,
+private val PodroidDark = darkColorScheme(
+ primary = PodroidAccent,
+ onPrimary = PodroidAccentInk,
+ primaryContainer = PodroidDarkSurface2,
+ onPrimaryContainer = PodroidDarkText,
+
+ secondary = PodroidAccent,
+ onSecondary = PodroidAccentInk,
+ secondaryContainer = PodroidDarkSurface2,
+ onSecondaryContainer= PodroidDarkText,
+
+ tertiary = PodroidAmber,
+ onTertiary = PodroidAccentInk,
+
+ background = PodroidDarkBg,
+ onBackground = PodroidDarkText,
+ surface = PodroidDarkSurface,
+ onSurface = PodroidDarkText,
+ surfaceVariant = PodroidDarkSurface2,
+ onSurfaceVariant = PodroidDarkTextMute,
+ surfaceContainerHighest = PodroidDarkSurface2,
+
+ outline = PodroidDarkBorder,
+ outlineVariant = PodroidDarkBorder,
+
+ error = PodroidRed,
+ onError = PodroidDarkText,
+ errorContainer = PodroidDarkSurface2,
+ onErrorContainer = PodroidRed,
)
-private val LightColorScheme = lightColorScheme(
- primary = Purple40,
- secondary = PurpleGrey40,
- tertiary = Cyan40,
+private val PodroidLight = lightColorScheme(
+ primary = PodroidAccent,
+ onPrimary = PodroidAccentInk,
+ primaryContainer = PodroidLightSurface2,
+ onPrimaryContainer = PodroidLightText,
+
+ secondary = PodroidAccent,
+ onSecondary = PodroidAccentInk,
+ secondaryContainer = PodroidLightSurface2,
+ onSecondaryContainer= PodroidLightText,
+
+ tertiary = PodroidAmber,
+ onTertiary = PodroidLightText,
+
+ background = PodroidLightBg,
+ onBackground = PodroidLightText,
+ surface = PodroidLightSurface,
+ onSurface = PodroidLightText,
+ surfaceVariant = PodroidLightSurface2,
+ onSurfaceVariant = PodroidLightTextMute,
+ surfaceContainerHighest = PodroidLightSurface2,
+
+ outline = PodroidLightBorder,
+ outlineVariant = PodroidLightBorder,
+
+ error = PodroidRed,
+ onError = PodroidLightText,
+ errorContainer = PodroidLightSurface2,
+ onErrorContainer = PodroidRed,
)
@Composable
fun PodroidTheme(
darkTheme: Boolean? = null,
- dynamicColor: Boolean = true,
+ dynamicColor: Boolean = false,
content: @Composable () -> Unit,
) {
val effectiveDark = darkTheme ?: isSystemInDarkTheme()
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
- val context = LocalContext.current
- if (effectiveDark) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
+ val ctx = LocalContext.current
+ if (effectiveDark) dynamicDarkColorScheme(ctx) else dynamicLightColorScheme(ctx)
}
- effectiveDark -> DarkColorScheme
- else -> LightColorScheme
+ effectiveDark -> PodroidDark
+ else -> PodroidLight
}
MaterialTheme(
colorScheme = colorScheme,
- typography = Typography,
+ typography = buildPodroidTypography(),
content = content,
)
}
diff --git a/app/src/main/java/com/excp/podroid/ui/theme/Type.kt b/app/src/main/java/com/excp/podroid/ui/theme/Type.kt
index cc61692..ebce9d9 100644
--- a/app/src/main/java/com/excp/podroid/ui/theme/Type.kt
+++ b/app/src/main/java/com/excp/podroid/ui/theme/Type.kt
@@ -1,34 +1,55 @@
package com.excp.podroid.ui.theme
import androidx.compose.material3.Typography
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.ReadOnlyComposable
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
-// Set of Material typography styles to start with
-val Typography = Typography(
- bodyLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 16.sp,
- lineHeight = 24.sp,
- letterSpacing = 0.5.sp
+/**
+ * Build a Material3 Typography that uses Inter as the base UI font family.
+ * Called from PodroidTheme — must be @Composable so we can resolve the
+ * asset-backed Inter family via LocalContext (see PodroidTokens.ui()).
+ */
+@Composable @ReadOnlyComposable
+fun buildPodroidTypography(): Typography {
+ val ui = PodroidTokens.ui()
+ return Typography(
+ displayLarge = TextStyle(
+ fontFamily = ui,
+ fontWeight = FontWeight.Thin,
+ fontSize = PodroidTokens.TypeSize.Display,
+ letterSpacing = (-0.02).sp,
+ lineHeight = 34.sp,
+ ),
+ headlineSmall = TextStyle(
+ fontFamily = ui,
+ fontWeight = FontWeight.SemiBold,
+ fontSize = PodroidTokens.TypeSize.Headline,
+ lineHeight = 26.sp,
+ ),
+ titleMedium = TextStyle(
+ fontFamily = ui,
+ fontWeight = FontWeight.Normal,
+ fontSize = PodroidTokens.TypeSize.Title,
+ letterSpacing = (-0.005).sp,
+ ),
+ bodyMedium = TextStyle(
+ fontFamily = ui,
+ fontWeight = FontWeight.Normal,
+ fontSize = PodroidTokens.TypeSize.Body,
+ lineHeight = 18.sp,
+ ),
+ labelMedium = TextStyle(
+ fontFamily = ui,
+ fontWeight = FontWeight.Normal,
+ fontSize = PodroidTokens.TypeSize.Label,
+ letterSpacing = 1.4.sp,
+ ),
)
- /* Other default text styles to override
- titleLarge = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Normal,
- fontSize = 22.sp,
- lineHeight = 28.sp,
- letterSpacing = 0.sp
- ),
- labelSmall = TextStyle(
- fontFamily = FontFamily.Default,
- fontWeight = FontWeight.Medium,
- fontSize = 11.sp,
- lineHeight = 16.sp,
- letterSpacing = 0.5.sp
- )
- */
-)
\ No newline at end of file
+}
+
+// Backwards-compat default so any direct `Typography` references in tooling
+// keep compiling. Real screens go through buildPodroidTypography() via Theme.
+val Typography = Typography()
\ No newline at end of file