Read design tokens in the git screens - #68
Merged
Conversation
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.
Why
:feature:gitwas the module that never adopted the design system's theme API — 52MaterialTheme.*usages, more than every other feature module combined. That is whyForbiddenImportwas the largest remaining detekt bucket.Reading tokens through
MaterialThemebypassesAslTheme, so those call sites silently miss anything the design system expresses that Material does not.What changed
49 of the 52 usages migrated across seven files, using a table derived from the
colorScheme(colors, dark)mapping indesignsystem/theme/Theme.kt:MaterialTheme.typography.XAslTypography.XcolorScheme.errorcolors.errorcolorScheme.onSurfaceVariantcolors.textSecondarycolorScheme.primarycolors.accentPrimarycolorScheme.onSurfacecolors.textPrimarycolorScheme.outlineVariantcolors.borderDefaultBehavior
No behavior change.
The typography substitutions are provably identical:
AslAppThemesetstypography = AslTypography, soMaterialTheme.typography.XandAslTypography.Xresolve to the sameTextStyleobject. The colour substitutions come straight from the explicitcopy(...)block inTheme.kt.Scope — three tokens deliberately left alone
surfaceVariant,tertiaryandsecondaryare not in that mapping. They fall through to the stockdarkColorScheme()/lightColorScheme()defaults, so these three call sites currently render with Material's default palette rather than this app's:GitDiffScreen.kt:325—surfaceVariantis the diff hunk-header row background.GitHistoryScreen.kt:300—tertiaryis the second git-graph palette entry (lane lines, edges, commit circles).GitHistoryScreen.kt:301—secondaryis the third git-graph palette entry.There is no equivalent design-system token, so substituting the closest-looking one would be a silent visual change with nothing in this project able to catch it. They are left exactly as they are, and those two files keep their
MaterialThemeimport solely for them.This is worth a deliberate design decision: either add tokens to
AslColorSchemefor these roles, or maptertiary/secondary/surfaceVariantinTheme.ktso they follow the palette. The git graph in particular already mixes these with two hardcoded literals (Color(0xFF43A047),Color(0xFFFF8F00)), so its palette is half-themed either way.Also reported, not changed:
:feature:gituses rawFontFamily.Monospacein several places whereAslCode.codeBody/codeSmall/codeTinyexist. Those differ in size and weight, so substituting is a visual change, not a substitution.Tests
No new tests. A token substitution with no logic to assert on.
Verification
./gradlew :feature:git:testDebugUnitTest— passes../gradlew :app:compileDebugKotlin— passes../gradlew detekt— passes.MaterialTheme.typographyusages remain in:feature:git.MaterialTheme.colorSchemeusages remain, and they are precisely the three unmapped ones listed above.MaterialTheme, each corresponding to one of those.Baseline
feature/git/detekt-baseline.xmlregenerated in its own commit — removals only, zero additions. Module entries 30 → 25; project total 368 → 363, down from 388.ForbiddenImportdrops 73 → 68.