android: derive full Material3 color scheme from theme tokens - #312
Open
DatScreamer wants to merge 1 commit into
Open
android: derive full Material3 color scheme from theme tokens#312DatScreamer wants to merge 1 commit into
DatScreamer wants to merge 1 commit into
Conversation
DatScreamer
force-pushed
the
fix/android-material3-color-schemes
branch
from
August 16, 2026 01:22
582d4fb to
5e9e623
Compare
LitterAppTheme only mapped 11 of 36 Material3 color roles, so Material3 components (sheets, dialogs, text fields, chips, cards) fell back to the baseline M3 surface palette. Add a build-time generator using the official material-color-utilities (Material Theme Builder engine) to derive every M3 role from the resolved Litter theme tokens, emit LitterMaterialSchemes.generated.kt, and consume it in LitterAppTheme. Adds a Makefile material-schemes stamp wired into android-debug and android-release, CI generation in shared-prep, and Node 24 setup.
DatScreamer
force-pushed
the
fix/android-material3-color-schemes
branch
from
August 16, 2026 01:23
5e9e623 to
ee5b326
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Fixes #311. Android's Material3 components were rendering with the default Material Design 3 surface palette because
LitterAppThemeonly mapped 11 of 36 M3 color roles. This PR derives the full 36-roleColorSchemefrom the existing Litter theme tokens using Google's official material-color-utilities (the engine behind the Material Theme Builder) as a build-time generator.Key changes
tools/scripts/generate-material-schemes.mjs— reads the same theme JSONs iOS bundles, resolves each to the existing Litter tokens (mirrorsLitterResolvedTheme.resolve/ iOSResolvedTheme.init, including the 8-digit#RRGGBBAA→ solid fix), seeds aDynamicSchemefrom those tokens, derives all 36 M3 roles viaMaterialDynamicColors, and emitsLitterMaterialSchemes.generated.kt.tools/scripts/register-esm.mjs/esm-resolver.mjs— loader hook so Node 24 can consume@material/material-color-utilities@0.4.0's extensionless ESM imports (stays on the latest version).LitterTheme.kt—LitterAppThemebuilds a complete 36-roleColorSchemefrom the generated roles, with fallback to the old 11-role mapping if a slug isn't found.material-schemesstamp target wired intoandroid-debugandandroid-release.mobile-ci.yml,android-apk-release.yml,android-play-release.yml: Node 24 + generator run in shared-prep, generated file shipped in thegenerated-mobile-sourcesartifact..gitignore—*.generated.ktso the build output stays local.Verification
LitterMaterialSchemes.generated.kt(85 × 36 roles).darkColorScheme/lightColorScheme.primary=#458588(its 8-digit#45858880resolves to the intended solid color, matching iOS); studio-lightbackground=#FFFFFF../gradlew :app:compileDebugKotlin— BUILD SUCCESSFUL../gradlew :app:testDebugUnitTest— BUILD SUCCESSFUL (all existing tests pass).assembleDebugproduces a launchable APK (native libs, Alpine fs, theme assets); installed and launched on an emulator.No iOS code or build path is changed (verified: no changes under
apps/ios/or anyios-*Makefile target).