Color Roles Not Raw Hex
Material 3 defines 30+ semantic color *roles* — `primary`, `onPrimary`, `surface`, `onSurfaceVariant`, `error`, `outline`, etc. — exposed in Compose as `MaterialTheme.colorScheme.<role>`.…
$ prime install @android-compose/rule-color-roles-not-raw-hex Projection
Always in _index.xml · the agent never has to ask for this.
ColorRolesNotRawHex [rule] v0.1.0
Material 3 defines 30+ semantic color roles — primary, onPrimary, surface, onSurfaceVariant, error, outline, etc. — exposed in Compose as MaterialTheme.colorScheme.<role>. Components and screens reference roles. The role-to-hex mapping lives in the theme and changes between light/dark, dynamic-color (Material You), high-contrast, and per-app brand schemes. Hard-coding a hex value bypasses every one of those swaps and breaks the moment a user toggles dark mode or dynamic color.
Loaded when retrieval picks the atom as adjacent / supporting.
ColorRolesNotRawHex [rule] v0.1.0
Material 3 defines 30+ semantic color roles — primary, onPrimary, surface, onSurfaceVariant, error, outline, etc. — exposed in Compose as MaterialTheme.colorScheme.<role>. Components and screens reference roles. The role-to-hex mapping lives in the theme and changes between light/dark, dynamic-color (Material You), high-contrast, and per-app brand schemes. Hard-coding a hex value bypasses every one of those swaps and breaks the moment a user toggles dark mode or dynamic color.
Checks
- All
Color(0xFF...)andColor.Red-style literals in app code are replaced withMaterialTheme.colorScheme.<role>. - Backgrounds use
surface,surfaceVariant, orsurfaceContainer*; foreground content on top uses the matchingonSurface*role. - Tinted brand actions use
primaryfor the action andonPrimaryfor content drawn on it; never invert this pair manually. - Errors use
error+onError; warnings/info derive fromtertiary/secondaryrather than ad-hoc orange/blue. - Dynamic color (Material You) is enabled on Android 12+ via
dynamicLightColorScheme/dynamicDarkColorSchemeso user wallpaper colors flow through.
Label
Reference Material 3 color roles, never raw hex literals
Loaded when retrieval picks the atom as a focal / direct hit.
ColorRolesNotRawHex [rule] v0.1.0
Material 3 defines 30+ semantic color roles — primary, onPrimary, surface, onSurfaceVariant, error, outline, etc. — exposed in Compose as MaterialTheme.colorScheme.<role>. Components and screens reference roles. The role-to-hex mapping lives in the theme and changes between light/dark, dynamic-color (Material You), high-contrast, and per-app brand schemes. Hard-coding a hex value bypasses every one of those swaps and breaks the moment a user toggles dark mode or dynamic color.
Checks
- All
Color(0xFF...)andColor.Red-style literals in app code are replaced withMaterialTheme.colorScheme.<role>. - Backgrounds use
surface,surfaceVariant, orsurfaceContainer*; foreground content on top uses the matchingonSurface*role. - Tinted brand actions use
primaryfor the action andonPrimaryfor content drawn on it; never invert this pair manually. - Errors use
error+onError; warnings/info derive fromtertiary/secondaryrather than ad-hoc orange/blue. - Dynamic color (Material You) is enabled on Android 12+ via
dynamicLightColorScheme/dynamicDarkColorSchemeso user wallpaper colors flow through.
Label
Reference Material 3 color roles, never raw hex literals
Label
Reference Material 3 color roles, never raw hex literals
Source
prime-system/examples/android-compose/primes/compiled/@android-compose/rule-color-roles-not-raw-hex/atom.yaml