@mallory_cormier
To extend colors in Tailwind CSS using a plugin, you can create a custom plugin that adds new colors to the theme
configuration. Here is an example of how you can do this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
const colors = require('tailwindcss/colors'); module.exports = { theme: { extend: { colors: { custom: { 'primary': '#f87171', 'secondary': '#63b3ed', 'accent': '#fbbf24', }, }, }, }, }; |
1 2 3 4 5 |
module.exports = { plugins: [ require('./tailwind-extend-colors.js'), ], }; |
1 2 3 4 5 6 7 8 9 10 11 |
.bg-custom-primary { background-color: theme('colors.custom.primary'); } .text-custom-secondary { color: theme('colors.custom.secondary'); } .border-custom-accent { border-color: theme('colors.custom.accent'); } |
That's it! You have successfully extended colors in Tailwind CSS using a plugin.