Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document recursive flatten color and backgroundImage #562

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/pages/docs/background-image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ You can add your own background images by editing the `theme.backgroundImage` se
backgroundImage: theme => ({
+ 'hero-pattern': "url('/img/hero-pattern.svg')",
+ 'footer-texture': "url('/img/footer-texture.png')",
+ brand: {
+ logo: {
+ default: "url('/img/brand-logo.svg')",
+ alt: "url('/img/brand-logo-alt.svg')",
+ }
+ }
})
}
}
Expand All @@ -56,7 +62,7 @@ You can add your own background images by editing the `theme.backgroundImage` se

These don't just have to be gradients — they can be any background images you need.

These classes will take the form `bg-{key}`, so `hero-pattern` will become `bg-hero-pattern` for example.
These classes will take the form `bg-{key}`, so `hero-pattern` will become `bg-hero-pattern`, `brand.logo.default` will become `bg-brand-logo` and `brand.logo.alt` will become `bg-brand-logo-alt`, for example.

### Responsive and pseudo-class variants

Expand Down
9 changes: 6 additions & 3 deletions src/pages/docs/customizing-colors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ module.exports = {
indigo: {
lighter: '#b3bcf5',
default: '#5c6ac4',
dark: '#202e78',
}
dark: {
default: '#202e78',
50: 'rgba(32,46,120,.5)'
},
},
}
}
}
```

Like many other places in Tailwind, the `default` key is special and means "no modifier", so this configuration would generate classes like `.text-indigo-lighter`, `.text-indigo`, and `.text-indigo-dark`.
Like many other places in Tailwind, the `default` key is special and means "no modifier", so this configuration would generate classes like `.text-indigo-lighter`, `.text-indigo`, `.text-indigo-dark` and `.text-indigo-dark-50`.

Note that you need to use dot notation to access nested colors when using the `theme()` function — the colors are only converted to dash-case for the actual CSS class names. The `default` key also needs to be specified when accessed via the `theme()` function: `theme('colors.indigo.default')`.

Expand Down