Created
August 27, 2025 10:30
-
-
Save Eronred/65feb6d1feecc148dad3eae6a42016bf to your computer and use it in GitHub Desktop.
Using Radix colors in React native projects with Nativewind
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @type {import('tailwindcss').Config} */ | |
| const { | |
| grayDark, | |
| grayDarkA, | |
| blueDark, | |
| pinkDark, | |
| amberDark, | |
| redDark | |
| } = require('@radix-ui/colors'); | |
| function radixScale(src, prefix) { | |
| const out = {}; | |
| for (let i = 1; i <= 12; i += 1) { | |
| out[i] = src[`${prefix}${i}`]; | |
| } | |
| return out; | |
| } | |
| module.exports = { | |
| content: [ | |
| './App.{js,jsx,ts,tsx}', | |
| './app/**/*.{js,jsx,ts,tsx}', | |
| './components/**/*.{js,jsx,ts,tsx}' | |
| ], | |
| presets: [require('nativewind/preset')], | |
| theme: { | |
| extend: { | |
| colors: { | |
| gray: radixScale(grayDark, 'gray'), | |
| grayA: radixScale(grayDarkA, 'grayA'), | |
| blue: radixScale(blueDark, 'blue'), | |
| pink: radixScale(pinkDark, 'pink'), | |
| amber: radixScale(amberDark, 'amber'), | |
| red: radixScale(redDark, 'red'), | |
| } | |
| } | |
| }, | |
| plugins: [] | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment