2021-09-02
1540
#css
Simohamed Marhraoui
64882
Sep 2, 2021 â‹… 5 min read

Creating custom themes with Tailwind CSS

Simohamed Marhraoui Vue and React developer | Linux enthusiast | Interested in FOSS

Recent posts:

Radix Ui Adoption Guide Overview Examples And Alternatives

Radix UI adoption guide: Overview, examples, and alternatives

Radix UI is quickly rising in popularity and has become an excellent go-to solution for building modern design systems and websites.

Nefe Emadamerho-Atori
Apr 25, 2024 â‹… 11 min read
Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 â‹… 7 min read
View all posts

4 Replies to "Creating custom themes with Tailwind CSS"

  1. Hi, I’ve got a question about the last section “Creating the themes using custom properties”
    What is your reasoning behind using theme/extend:

    “`js
    module.exports = {
    theme: {
    extend: {
    textColor,
    backgroundColor,
    },
    },
    }
    “`

    vs theme/colors (I also see in tailwind docs: https://tailwindcss.com/docs/customizing-colors)

    “`js
    module.exports = {
    theme: {
    colors: {
    primary: withOpacityValue(‘–color-primary’),
    secondary: withOpacityValue(‘–color-secondary’),
    // …
    }
    }
    }
    “`

    What would be the use-case to use either solutions?

    1. Hi!

      The first approach would add to Tailwind’s own colors (the bg-red-500s and the border-green-900s,) while the second approach would mean that you’re creating a color palette entirely from scratch, i.e., no default Tailwind colors.

      If your own design system already defines the color palette in its entirety (including blacks and grays, etc.) the second approach would be a no-brainer.

      Hope this makes sense.

Leave a Reply