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

Simplified Theme Customization with Color Roles #1523

Open
guplem opened this issue Jan 7, 2025 · 1 comment
Open

Simplified Theme Customization with Color Roles #1523

guplem opened this issue Jan 7, 2025 · 1 comment

Comments

@guplem
Copy link

guplem commented Jan 7, 2025

Description
Flowbite currently uses mainly "cyan" as the default color, making it hard (and weird) to customize the primary color (or the main color palette).
Introducing color roles like "primary," "secondary," and "accent"—inspired by frameworks like Material 3—would make theme customization more intuitive and scalable.

Why is this needed?

  1. Easier Customization: Allow defining roles (e.g., primary) directly in the TailwindCSS configuration.
  2. Consistency: Use semantic roles to ensure a unified and consistent look across components.
  3. Alignment with Design Standards: Adopt modern practices similar to Material 3, which uses well-defined color roles.

Proposed Solution
Add semantic color roles such as primary, secondary, and accent to the default TailwindCSS theme. These roles can be customized globally in the theme.extend.colors section.

Example Implementation

module.exports = {
  theme: {
    extend: {
      colors: {
        primary: {
          50: "#f7f6ff",
          500: "#5645f5", // Main primary color
          900: "#2a2278",
        },
        secondary: {
          500: "#03DAC5", // Example secondary color
        },
        accent: {
          500: "#FF5722", // Example accent color
        },
      },
    },
  },
  plugins: [require("flowbite/plugin")],
};

Components would reference roles such as theme('colors.primary.500'), theme('colors.secondary.500'), or theme('colors.accent.500') instead of hardcoding specific colors like cyan.

Relevant Discussion
This proposal addresses concerns raised in GitHub Discussion #973. Developers noted the difficulty of overriding "cyan" as the default, and introducing semantic roles simplifies customization. Material 3’s color roles provide a great reference for this approach.

Conclusion
Introducing semantic color roles like primary, secondary, and accent in TailwindCSS for Flowbite would improve usability, consistency, and alignment with modern design standards. This change reduces confusion and makes theme customization more flexible.

Feedback is welcome!

@SutuSebastian
Copy link
Collaborator

There's a theming system revamp happening in #1498 PR, but only the primary color will be used within the components.
We'll revise the rest of color tokens (eg: brand, secondary, accent) in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants