11@props ([' columnId' , ' column' , ' config' ] )
22
33@php
4- use Filament\Support\Colors\ Color ;
5- $colors = Color:: all ();
4+ use Filament\Support\Colors\ Color ;use Filament\Support\Facades\ FilamentColor ;
65
7- if (filled ($column [' color' ])) {
8- $color = $colors [$column [' color' ]] ?? Color:: generateV3Palette ($column [' color' ]);
9- }
10- else {
11- $color = $colors [' neutral' ];
6+ $filamentColors = FilamentColor:: getColors ();
7+ $nativeColor = null ;
8+
9+ if (filled ($column [' color' ]) && isset ($filamentColors [$column [' color' ]])) {
10+ $nativeColor = $column [' color' ];
11+ }else {
12+ $color = Color:: hex ($column [' color' ]);
1213 }
1314@endphp
1415
@@ -20,13 +21,31 @@ class="w-[300px] min-w-[300px] flex-shrink-0 border border-gray-200 dark:border-
2021 <h3 class =" text-sm font-medium text-gray-700 dark:text-gray-200" >
2122 {{ $column [' label' ] } }
2223 </h3 >
23- <div
24- style =" background-color : {{ $color [500 ] }}; color : {{ $color [50 ] }};"
25- @class ([
26- ' ms-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium' ,
27- ] )>
28- {{ $column [' total' ] ?? (isset ($column [' items' ]) ? count ($column [' items' ]) : 0 ) } }
29- </div >
24+ @if ($nativeColor )
25+ <x-filament::badge
26+ tag =" div"
27+ :color =" $nativeColor"
28+ class =" ms-2"
29+ >
30+ {{ $column [' total' ] ?? (isset ($column [' items' ]) ? count ($column [' items' ]) : 0 ) } }
31+ </x-filament::badge >
32+ @else
33+ <div
34+ @style ([
35+ " --light-bg-color: $color [50 ]" ,
36+ " --light-text-color: $color [700 ]" ,
37+ " --dark-bg-color: $color [600 ]" ,
38+ " --dark-text-color: $color [300 ]" ,
39+ ] )
40+ @class ([
41+ ' ms-2 items-center border px-2 py-0.5 rounded-md text-xs font-semibold' ,
42+ " bg-[var(--light-bg-color)] dark:bg-[var(--dark-bg-color)]/20" ,
43+ " text-[var(--light-text-color)] dark:text-[var(--dark-text-color)]" ,
44+ ' border-[var(--light-text-color)]/30 dark:border-[var(--dark-text-color)]/30' ,
45+ ] )>
46+ {{ $column [' total' ] ?? (isset ($column [' items' ]) ? count ($column [' items' ]) : 0 ) } }
47+ </div >
48+ @endif
3049 </div >
3150
3251
0 commit comments