# noReactNativeLiteralColors

Rule `biome/noReactNativeLiteralColors`. Disallow color literals in React Native styles.

- Source: biome
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1931 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `style/noReactNativeLiteralColors` | no | no | group style, since 2.4.13 | [docs](https://biomejs.dev/linter/rules/no-react-native-literal-colors/) |

## Code examples

### Incorrect: the rule reports this

```jsx
const Hello = () => <Text style={{ backgroundColor: '#FFFFFF' }}>hi</Text>;
```

```jsx
const styles = StyleSheet.create({
    text: { color: 'red' }
});
```

```jsx
const Hello = (flag) => (
    <Text style={{ backgroundColor: flag ? '#fff' : '#000' }}>hi</Text>
);
```

### Correct: the rule accepts this

```jsx
const red = '#f00';
const styles = StyleSheet.create({
    text: { color: red }
});
```

```jsx
const Hello = () => (
    <Text style={{ backgroundColor: theme.background }}>hi</Text>
);
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noReactNativeLiteralColors": "error"
      }
    }
  }
}
```

## Related rules

- [biome/noReactForwardRef](https://lintradar.dev/rules/biome/noReactForwardRef.md): Replaces usages of `forwardRef` with passing `ref` as a prop.
- [biome/noReactPropAssignments](https://lintradar.dev/rules/biome/noReactPropAssignments.md): Disallow assigning to React component props.
- [biome/noPseudoElementInFunctionalPseudoClass](https://lintradar.dev/rules/biome/noPseudoElementInFunctionalPseudoClass.md): Disallow pseudo-elements inside `:is()`, `:where()`, `:not()` and `:has()`.
- [biome/noReExportAll](https://lintradar.dev/rules/biome/noReExportAll.md): Avoid re-export all.
- [biome/noProcessGlobal](https://lintradar.dev/rules/biome/noProcessGlobal.md): Disallow the use of `process` global.
- [biome/noRestrictedDependencies](https://lintradar.dev/rules/biome/noRestrictedDependencies.md): Disallow dependencies that are known to have better alternatives.

---

Web page: https://lintradar.dev/rules/biome/noReactNativeLiteralColors. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
