Skip to content

Read design tokens in the git screens - #68

Merged
AhmadKharfan merged 2 commits into
developfrom
refactor/git-design-tokens
Jul 29, 2026
Merged

Read design tokens in the git screens#68
AhmadKharfan merged 2 commits into
developfrom
refactor/git-design-tokens

Conversation

@AhmadKharfan

Copy link
Copy Markdown
Owner

Why

:feature:git was the module that never adopted the design system's theme API — 52 MaterialTheme.* usages, more than every other feature module combined. That is why ForbiddenImport was the largest remaining detekt bucket.

Reading tokens through MaterialTheme bypasses AslTheme, 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 in designsystem/theme/Theme.kt:

Was Now Count
MaterialTheme.typography.X AslTypography.X 38
colorScheme.error colors.error 4
colorScheme.onSurfaceVariant colors.textSecondary 3
colorScheme.primary colors.accentPrimary 2
colorScheme.onSurface colors.textPrimary 1
colorScheme.outlineVariant colors.borderDefault 1

Behavior

No behavior change.

The typography substitutions are provably identical: AslAppTheme sets typography = AslTypography, so MaterialTheme.typography.X and AslTypography.X resolve to the same TextStyle object. The colour substitutions come straight from the explicit copy(...) block in Theme.kt.

Scope — three tokens deliberately left alone

surfaceVariant, tertiary and secondary are not in that mapping. They fall through to the stock darkColorScheme() / lightColorScheme() defaults, so these three call sites currently render with Material's default palette rather than this app's:

  • GitDiffScreen.kt:325surfaceVariant is the diff hunk-header row background.
  • GitHistoryScreen.kt:300tertiary is the second git-graph palette entry (lane lines, edges, commit circles).
  • GitHistoryScreen.kt:301secondary is 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 MaterialTheme import solely for them.

This is worth a deliberate design decision: either add tokens to AslColorScheme for these roles, or map tertiary/secondary/surfaceVariant in Theme.kt so 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:git uses raw FontFamily.Monospace in several places where AslCode.codeBody / codeSmall / codeTiny exist. 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.
  • Zero MaterialTheme.typography usages remain in :feature:git.
  • Exactly three MaterialTheme.colorScheme usages remain, and they are precisely the three unmapped ones listed above.
  • Only two files still import MaterialTheme, each corresponding to one of those.

Baseline

feature/git/detekt-baseline.xml regenerated in its own commit — removals only, zero additions. Module entries 30 → 25; project total 368 → 363, down from 388. ForbiddenImport drops 73 → 68.

@AhmadKharfan
AhmadKharfan merged commit fee0e1a into develop Jul 29, 2026
2 checks passed
@AhmadKharfan
AhmadKharfan deleted the refactor/git-design-tokens branch July 29, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant