P粉7624473632023-09-04 14:04:32
You can use tw-colors to create a predefined theme p>
const { createThemes } = require('tw-colors'); module.exports = { content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], plugins: [ createThemes({ banana: { 'primary': 'steelblue', 'secondary': 'darkblue', 'brand': '#F3F3F3', }, halloween: { 'primary': 'turquoise', 'secondary': 'tomato', 'brand': '#4A4A4A', }, darkula: { 'primary': '#2A9D8F', 'secondary': '#E9C46A', 'brand': '#264653', }, }) ], };
Then apply the theme to the card container
<div class='theme-darkcula'> <h2 class='text-primary'>Username</h2> <p class='text-secondary'>...</p> </div> <div class='theme-halloween'> <h2 class='text-primary'>Username</h2> <p class='text-secondary'>...</p> </div>
If subject class names come from API responses, you should safelist them, otherwise tailwind will not generate them, see tailwind documentation for more details