Introduction
Theme customization helps make your website look unique and match your brand colors and style.
Theme customization helps make your website look unique and match your brand colors and style.
module.exports = {
theme: {
extend: {
colors: {
customBlue: '#1E40AF'
},
fontFamily: {
customFont: ['Arial', 'sans-serif']
}
}
}
};extend to add new styles without removing default Tailwind styles.theme section.brandRed to use in your classes like text-brandRed.module.exports = {
theme: {
extend: {
colors: {
brandRed: '#EF4444'
}
}
}
};heading to use with font-heading.module.exports = {
theme: {
extend: {
fontFamily: {
heading: ['Georgia', 'serif']
}
}
}
};This example shows how to add a custom green color and a custom font to Tailwind. The background and font change to show the new theme.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Custom Theme Example</title> <script src="https://cdn.tailwindcss.com"></script> <script> tailwind.config = { theme: { extend: { colors: { customGreen: '#10B981' }, fontFamily: { customSans: ['Comic Sans MS', 'cursive'] } } } }; </script> </head> <body class="bg-customGreen font-customSans p-6"> <h1 class="text-white text-3xl">Hello with Custom Theme!</h1> <p class="text-white mt-2">This page uses a custom green background and a fun font.</p> </body> </html>
Always use extend to keep default Tailwind styles available.
Test your colors and fonts on different devices to ensure readability and good contrast.
Theme customization lets you make your site look unique and match your brand.
You can change colors, fonts, spacing, and more easily with Tailwind.
Use the extend option to add new styles without losing defaults.
extend option allows adding new styles while keeping defaults.extend adds new colors without removing default ones.bg-primary apply?{
theme: {
extend: {
colors: {
primary: '#1DA1F2'
}
}
}
}primary with value #1DA1F2.bg-primary uses the primary color defined in the config.{
theme: {
fontFamily: {
custom: ['Comic Sans MS', 'cursive']
}
}
}fontFamily directly, replacing all default fonts.extend inside theme.72 with value 18rem but keep all default spacing sizes. Which config snippet correctly does this?extend inside theme.theme.extend.spacing to add 72: '18rem' while keeping defaults.Pass the test and this pattern moves unknown