Sheath rule
native-prefer-theme-tokens
NativePHP interface colors should use theme tokens instead of fixed arbitrary
colors.
#Why
Fixed hex colors compile successfully, but they do not change with the application theme. Theme tokens can provide separate light and dark values.
#Examples
#Bad
{{-- The fixed hex color cannot adapt to the active theme. --}}
<native:column class="bg-[#1E2021]">
<native:text>Account</native:text>
</native:column>
#Good
{{-- Theme tokens can resolve separate surface colors. --}}
<native:column class="bg-theme-surface">
<native:text class="text-theme-on-surface">Account</native:text>
</native:column>
#Scope
The guideline applies to fixed arbitrary colors in native background, text, and border color utilities. Named palette classes remain allowed because they may be a deliberate design choice.
Only valid fixed colors produce this guideline finding. Invalid color utilities are outside its scope.
#Options
All NativePHP rules accept nativeViewPaths. The default is
['views/native/']. See Native View Detection
for path configuration.
#See Also
Related rules validate the selected token and class:
- native-unknown-theme-token: Require the token to resolve
- native-dead-class: Report invalid color utilities