© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Čamap

Use colors setup from certain panel in external livewire layout/component

When using
colors
colors
builder method such as:

public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('app')
        ->path('v2')
        ->login()
        ->colors([
            'danger' => Color::Rose,
            'primary' => Color::Teal,
            'secondary' => Color::Gray,
            'success' => Color::Green,
            'warning' => Color::Yellow,
        ])
        ...
        ..
        .
public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('app')
        ->path('v2')
        ->login()
        ->colors([
            'danger' => Color::Rose,
            'primary' => Color::Teal,
            'secondary' => Color::Gray,
            'success' => Color::Green,
            'warning' => Color::Yellow,
        ])
        ...
        ..
        .


How do I import this color setup into an external layout used outside of filament? Is there maybe a method familiar to
{{ filament()->getTheme()->getHtml() }}
{{ filament()->getTheme()->getHtml() }}
, but for colors instead ?
Solution
use Filament\Support\Facades\FilamentColor;

$cssVariables = [];

foreach (FilamentColor::getColors() as $name => $shades) {
    foreach ($shades as $shade => $color) {
        $cssVariables["{$name}-{$shade}"] = $color;
    }
}

<style>
    :root {
        @foreach ($cssVariables ?? [] as $cssVariableName => $cssVariableValue) --{{ $cssVariableName }}:{{ $cssVariableValue }}; @endforeach
    }
</style>
use Filament\Support\Facades\FilamentColor;

$cssVariables = [];

foreach (FilamentColor::getColors() as $name => $shades) {
    foreach ($shades as $shade => $color) {
        $cssVariables["{$name}-{$shade}"] = $color;
    }
}

<style>
    :root {
        @foreach ($cssVariables ?? [] as $cssVariableName => $cssVariableValue) --{{ $cssVariableName }}:{{ $cssVariableValue }}; @endforeach
    }
</style>
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

use filamentphp layout in livewire component
FilamentFFilament / ❓┊help
2y ago
Unable to use colors on blade components in livewire form component
FilamentFFilament / ❓┊help
3y ago
Form component colors not working in Livewire component
FilamentFFilament / ❓┊help
2y ago
Use Table-Widget in Livewire Component / Outside Admin Panel
FilamentFFilament / ❓┊help
3y ago