0
0
Tailwindmarkup~5 mins

Overriding color palette in Tailwind - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of overriding the color palette in Tailwind CSS?
Overriding the color palette lets you customize the default colors to match your brand or design needs, making your website unique and consistent.
Click to reveal answer
beginner
Where do you define custom colors to override the default palette in Tailwind CSS?
You define custom colors inside the tailwind.config.js file under the theme.extend.colors section.
Click to reveal answer
intermediate
How do you keep the default colors and add new custom colors in Tailwind?
Use theme.extend.colors to add new colors without removing the default palette. This way, you extend instead of replace the colors.
Click to reveal answer
intermediate
What happens if you define colors directly under theme.colors instead of theme.extend.colors?
Defining colors directly under theme.colors replaces the entire default color palette, removing all default colors.
Click to reveal answer
beginner
Show a simple example of overriding the color palette to add a custom blue color named brandBlue.
In tailwind.config.js:
module.exports = {
  theme: {
    extend: {
      colors: {
        brandBlue: '#1E40AF'
      }
    }
  }
}
Click to reveal answer
Where should you add custom colors to keep the default Tailwind colors?
AInside theme.extend.colors
BInside theme.colors
CInside plugins array
DInside purge array
What is the effect of defining colors directly under theme.colors in tailwind.config.js?
AIt removes all default colors and replaces them
BIt causes an error
CIt has no effect
DIt extends the default colors
Which file do you edit to override the Tailwind color palette?
Aindex.html
Bpackage.json
Ctailwind.config.js
Dstyles.css
If you want a custom color named 'brandRed' with hex #FF0000, how do you add it without losing default colors?
AAdd brandRed under theme.colors
BAdd brandRed in index.html
CAdd brandRed in styles.css
DAdd brandRed under theme.extend.colors
Why is it important to override colors instead of editing Tailwind source files?
ABecause Tailwind source files are read-only
BTo keep Tailwind updates easy and avoid losing changes
CBecause colors cannot be changed
DTo make the website load faster
Explain how to add a new custom color to Tailwind CSS without losing the default colors.
Think about extending the theme instead of replacing it.
You got /4 concepts.
    Describe the difference between defining colors under theme.colors and theme.extend.colors in Tailwind.
    One replaces, the other extends.
    You got /3 concepts.