livewire / flux

The official Livewire UI component library
446 stars 38 forks source link

Suggestion: Easily configurable color variants #44

Closed ttrushin closed 4 weeks ago

ttrushin commented 4 weeks ago

The Tailwind zinc color seems to be used as the "primary" color throughout the entire project. Ideally we wouldn't have to publish every single component just to change the primary color.

It would be nice if a custom color name like primary were used throughout Flux instead of zinc, and instructions were added to the docs to add a custom color called "primary" to the Tailwind config (which devs already have to modify), which one could just default to colors.zinc if desired, or change at will.

challgren commented 4 weeks ago

You could override the class with !border-indigo-200, that's what I've been doing but it's a pain

troccoli commented 4 weeks ago

I would love that too.

Currently I'm overriding the zinc colour in my tailwind.config.js. It works, but I feel it's a bit dangerous as the zinc colours are used for text, border, separators, background, etc.

ttrushin commented 4 weeks ago

@challgren Definitely possible, however some of the components use extremely custom things like calculated shadows in the button component. It would be quite painful to override everything.

->add(match ($variant) { // Shadows...
        'primary' => 'shadow-[inset_0px_1px_theme(colors.zinc.900),inset_0px_2px_theme(colors.white/.15)] dark:shadow-none',
    })

@troccoli Yep, I thought about that, but for the reasons you stated that becomes undesirable pretty fast.

ttrushin commented 4 weeks ago

@calebporzio This feels like a perfect tweak to make to this component library to allow for a beautiful customization experience without requiring users to publish and carefully tweak every single component that has variants.

calebporzio commented 4 weeks ago

I understand many people want this. I think my answer for right now is going to be either publish all the views, or rather tweak your tailwind config to use a different color palette instead of zinc.

I'm not saying "no", just "no right now" if that makes sense. Thanks!