Posted Sunday, September 24, 2023

Access Tailwind settings from CSS

Use the tailwind.config.js as a source of truth

The theme directive

Access the configuration from within your css.

From your tailwind.config.js:

colors: {
  primary: {
    500: '#0E70ED',
    600: '#0552b3'
  }
}

In your css:

.prose a.custom-link {
  color: theme('colors.primary.500');
}