How to Passing value for color in extraAttributes to them.css?

I want to Passing value for color in extraAttributes to them.css .cuze the color from database
No description
11 Replies
Dan Harrin
Dan Harrin7mo ago
The best way to output colors from the database is via inline styles you could add “style” as an extraattribute
Alnuaimi
AlnuaimiOP7mo ago
ok ,but I have class inside class ,so I want to change color for internal class
Dan Harrin
Dan Harrin7mo ago
use the style attribute to define a css variable and use the css variable inside the internal class
Alnuaimi
AlnuaimiOP7mo ago
I want to change Select not cell my cod is ->extraAttributes(fn($record) => [ 'style' =>"background-color:red" ])
No description
Alnuaimi
AlnuaimiOP7mo ago
I want do like this image
No description
Dan Harrin
Dan Harrin7mo ago
define the css variable in the style attribute, then add a class to your theme css that targets the select box and applies the bg color from the css variable
Alnuaimi
AlnuaimiOP7mo ago
where define the css variable?plase
->extraAttributes(fn($record) => [ 'class' => match ($record->compliance_status) { 'Compliant' => 'class-Compliant', 'Not Applicable' => 'class-Not-Applicable', 'Not Compliant' => 'class-Not-Compliant', 'Partially Compliant' => 'class-Partially-Compliant', default => 'class-default', // Handle other cases if necessary }, 'style' => "color: " . $record->color . ";", // Add this line to set the color ])
Dan Harrin
Dan Harrin7mo ago
i dont have time to write out code for every single question, you should have a go yourself and post the solution for others
Alnuaimi
AlnuaimiOP7mo ago
ok,brother
Alnuaimi
AlnuaimiOP7mo ago
thanks alot brother ,I fixed after you help me thanks
No description
Want results from more Discord servers?
Add your server