Skip to content

Instantly share code, notes, and snippets.

@Eronred
Created August 27, 2025 10:30
Show Gist options
  • Select an option

  • Save Eronred/65feb6d1feecc148dad3eae6a42016bf to your computer and use it in GitHub Desktop.

Select an option

Save Eronred/65feb6d1feecc148dad3eae6a42016bf to your computer and use it in GitHub Desktop.
Using Radix colors in React native projects with Nativewind
/** @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