F
Filament12mo ago
daudau

how to use Filament `primary`, `success` color

Hi, I want to use some color of Filament in custom form field to consistency look and field, but I don't know how to make it, because user can change the color in the PanelServiceProvider. Anyone has a good approach for this situation, thank you
Solution:
peer-checked:[--tw-ring-color:rgba(var(--primary-500),1)]
peer-checked:[--tw-ring-color:rgba(var(--primary-500),1)]
Solved using this one, but it seem terrible...
Jump to solution
9 Replies
Lara Zeus
Lara Zeus12mo ago
you mean you want to let your users chose the color? maybe this can help https://filamentphp.com/community/mohamedsabil83-easy-way-to-benefit-from-the-new-color-mechanism-in-frontend
Filament
Customizing colors per-user outside of a panel by Mohamed Sabil - F...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
daudau
daudauOP12mo ago
nope, I mean in my plugin custom field, I do has a class like peer-checked:ring-primary-900, but it's doesn't work in Filament because the color is not the same in the user config (in the PanelProvider) vs in my tailwind.config.js file of my plugin
daudau
daudauOP12mo ago
No description
daudau
daudauOP12mo ago
as you can see, the border of name input is configured by the user the provider checkbox is a custom form field, and the border not the same I though it should be something in css variable tho, but I don't know how
Solution
daudau
daudau12mo ago
peer-checked:[--tw-ring-color:rgba(var(--primary-500),1)]
peer-checked:[--tw-ring-color:rgba(var(--primary-500),1)]
Solved using this one, but it seem terrible
daudau
daudauOP12mo ago
squint
awcodes
awcodes12mo ago
Since you’re users are setting their own color and tailwind compiles against the code base you will have to use the css property approach in this specific use case.
daudau
daudauOP12mo ago
thanks, btw it feel little pain when write css like that 🥹 , luckily I only have to write it once
awcodes
awcodes12mo ago
yea, just the nature of tailwind and how it works. It's just not meant to be modular like that. 🙂
Want results from more Discord servers?
Add your server