Android · resources
Android colors.xml generator
Emit <color name="prefix_weight">#RRGGBB</color> rows that match the same ramp logic as the
web token tools. Android still wants opaque HEX here — OKLCH mode only changes how we compute those HEX values,
not the file format.
Why this Android exporter exists
Marketing ships HEX on the web while Kotlin still reads R.color.brand_500. This tool emits
opaque color rows with predictable snake_case names from the same ramp
engine as CSS and Tailwind — one fewer place for purple to drift between platforms.
How to use it
- Align base HEX and ramp mode with CSS variables or Tailwind snippet first.
- Choose a prefix; digits at the start get a safe prefix to satisfy Android resource rules.
- Copy XML and merge into
res/values/colors.xml(or a flavor-specific file). - Use ColorStateList resources when you need alpha on pressed states — this output stays opaque on purpose.
Material You / dynamic color
This helper is for static ramps. Dynamic color pipelines need different XML and runtime APIs — do not pretend this file replaces them.
Why match web and Android?
Platform color management will still differ, but you remove the class of bugs where marketing and install screens started from different hand-entered HEX values.
Material reality
- Hyphens in prefixes become underscores automatically.
- Search for duplicate
namekeys before pasting huge blocks — the tool does not know your repo.
Notes & FAQ
How do I keep XML aligned with web tokens?
Run the same base color and ramp mode through the CSS variables or Tailwind exporter first, then paste Android XML from here — the engines match by design.
Alpha / Material You
Opaque HEX only in this output. Transparency belongs in <alpha> resources, ColorStateList XML,
or runtime Color APIs — pick the pattern your team already standardized on.
Can I use lowercase HEX?
Output uses uppercase #RRGGBB for consistency with older Android examples. Gradle does not care;
change case in your editor if your style guide insists.
Does this validate duplicate names?
No — if brand_500 already exists in your resources, the merger wins or the build fails depending on
tooling. Search your XML before pasting huge blocks.