Skip to content

Commit 9841cf6

Browse files
committed
UP
1 parent 20a57a4 commit 9841cf6

File tree

12 files changed

+957
-450
lines changed

12 files changed

+957
-450
lines changed

README.md

Lines changed: 184 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ class Task extends Model
6969
'done' => 'Done',
7070
];
7171
}
72+
73+
/**
74+
* Get the status colors for the Kanban board.
75+
*
76+
* @return array<string, string>
77+
*/
78+
public function kanbanStatusColors(): array
79+
{
80+
return [
81+
'todo' => 'blue',
82+
'in_progress' => 'yellow',
83+
'in_review' => 'purple',
84+
'done' => 'green',
85+
];
86+
}
7287
}
7388
```
7489

@@ -93,12 +108,14 @@ class TaskKanbanBoard extends KanbanBoard
93108

94109
$this->statusField('status')
95110
->statusValues(Task::getStatusOptions())
111+
->statusColors([
112+
'todo' => 'blue',
113+
'in_progress' => 'yellow',
114+
'in_review' => 'purple',
115+
'done' => 'green',
116+
])
96117
->titleAttribute('title')
97-
->descriptionAttribute('description')
98-
->cardAttributes([
99-
'priority' => 'Priority',
100-
'due_date' => 'Due Date',
101-
]);
118+
->descriptionAttribute('description');
102119
}
103120

104121
protected function getHeaderActions(): array
@@ -147,6 +164,168 @@ protected function getHeaderActions(): array
147164
}
148165
```
149166

167+
### Customizing Column Colors
168+
169+
Flowforge allows you to customize the colors of your Kanban board columns. You can choose from a predefined set of Tailwind colors:
170+
171+
- default
172+
- slate
173+
- gray
174+
- zinc
175+
- neutral
176+
- stone
177+
- red
178+
- orange
179+
- amber
180+
- yellow
181+
- lime
182+
- green
183+
- emerald
184+
- teal
185+
- cyan
186+
- sky
187+
- blue
188+
- indigo
189+
- violet
190+
- purple
191+
- fuchsia
192+
- pink
193+
- rose
194+
195+
The colors are defined in the CSS file and can be easily customized by publishing the assets:
196+
197+
```bash
198+
php artisan vendor:publish --tag="flowforge-assets"
199+
```
200+
201+
Then you can modify the CSS classes in `resources/css/vendor/flowforge/flowforge.css`.
202+
203+
To customize column colors, you can use one of the following methods:
204+
205+
### Method 1: Using DefaultKanbanAdapter
206+
207+
```php
208+
use Relaticle\Flowforge\Adapters\DefaultKanbanAdapter;
209+
210+
// With custom colors
211+
$adapter = new DefaultKanbanAdapter(
212+
Task::class,
213+
'status',
214+
[
215+
'todo' => 'To Do',
216+
'in_progress' => 'In Progress',
217+
'in_review' => 'In Review',
218+
'done' => 'Done',
219+
],
220+
'title',
221+
'description',
222+
[], // card attributes
223+
[
224+
'todo' => 'blue',
225+
'in_progress' => 'yellow',
226+
'in_review' => 'purple',
227+
'done' => 'green',
228+
]
229+
);
230+
```
231+
232+
### Method 2: Custom Adapter Implementation
233+
234+
If you're creating a custom adapter, implement the `getStatusColors()` method:
235+
236+
```php
237+
public function getStatusColors(): ?array
238+
{
239+
return [
240+
'todo' => 'indigo',
241+
'in_progress' => 'amber',
242+
'in_review' => 'violet',
243+
'done' => 'emerald',
244+
];
245+
}
246+
```
247+
248+
### Method 3: Model-based Configuration
249+
250+
Define a `kanbanStatusColors` method in your model:
251+
252+
```php
253+
/**
254+
* Get the status colors for the Kanban board.
255+
*
256+
* @return array<string, string>
257+
*/
258+
public function kanbanStatusColors(): array
259+
{
260+
return [
261+
'todo' => 'blue',
262+
'in_progress' => 'yellow',
263+
'in_review' => 'purple',
264+
'done' => 'green',
265+
];
266+
}
267+
```
268+
269+
### Method 4: Filament Resource Page
270+
271+
Set the colors directly in your Filament page:
272+
273+
```php
274+
public function mount(): void
275+
{
276+
parent::mount();
277+
278+
$this->statusField('status')
279+
->statusValues(Task::getStatusOptions())
280+
->statusColors([
281+
'todo' => 'blue',
282+
'in_progress' => 'yellow',
283+
'in_review' => 'purple',
284+
'done' => 'green',
285+
])
286+
->titleAttribute('title')
287+
->descriptionAttribute('description');
288+
}
289+
```
290+
291+
If a status doesn't have a color defined, it will use the default styling.
292+
293+
### Customizing Column Status Badges
294+
295+
Flowforge allows you to customize the colors of the count badges in your Kanban board columns. These are the small rounded indicators that show the number of cards in each column. You can choose from a predefined set of Tailwind colors:
296+
297+
- default
298+
- slate
299+
- gray
300+
- zinc
301+
- neutral
302+
- stone
303+
- red
304+
- orange
305+
- amber
306+
- yellow
307+
- lime
308+
- green
309+
- emerald
310+
- teal
311+
- cyan
312+
- sky
313+
- blue
314+
- indigo
315+
- violet
316+
- purple
317+
- fuchsia
318+
- pink
319+
- rose
320+
321+
The badge colors are defined in the CSS file and can be easily customized by publishing the assets:
322+
323+
```bash
324+
php artisan vendor:publish --tag="flowforge-assets"
325+
```
326+
327+
Then you can modify the CSS classes in `resources/css/vendor/flowforge/flowforge.css`.
328+
150329
## Advanced Usage
151330

152331
### Standalone Kanban Board Page

resources/css/flowforge.css

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
@apply animate-pulse rounded-md bg-gray-200 dark:bg-gray-700;
295295
}
296296

297-
/* Add Status Color Classes */
297+
/* Add Status Color Classes for count badges */
298298
.kanban-status-todo {
299299
@apply bg-slate-200 text-slate-700 dark:bg-slate-700 dark:text-slate-200;
300300
}
@@ -311,6 +311,99 @@
311311
@apply bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300;
312312
}
313313

314+
/* Kanban badge color classes - used for count badges */
315+
.kanban-color-default {
316+
@apply bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200;
317+
}
318+
319+
.kanban-color-slate {
320+
@apply bg-slate-200 text-slate-700 dark:bg-slate-700 dark:text-slate-200;
321+
}
322+
323+
.kanban-color-gray {
324+
@apply bg-gray-200 text-gray-700 dark:bg-gray-700 dark:text-gray-200;
325+
}
326+
327+
.kanban-color-zinc {
328+
@apply bg-zinc-200 text-zinc-700 dark:bg-zinc-700 dark:text-zinc-200;
329+
}
330+
331+
.kanban-color-neutral {
332+
@apply bg-neutral-200 text-neutral-700 dark:bg-neutral-700 dark:text-neutral-200;
333+
}
334+
335+
.kanban-color-stone {
336+
@apply bg-stone-200 text-stone-700 dark:bg-stone-700 dark:text-stone-200;
337+
}
338+
339+
.kanban-color-red {
340+
@apply bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300;
341+
}
342+
343+
.kanban-color-orange {
344+
@apply bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300;
345+
}
346+
347+
.kanban-color-amber {
348+
@apply bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300;
349+
}
350+
351+
.kanban-color-yellow {
352+
@apply bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300;
353+
}
354+
355+
.kanban-color-lime {
356+
@apply bg-lime-100 text-lime-700 dark:bg-lime-900/50 dark:text-lime-300;
357+
}
358+
359+
.kanban-color-green {
360+
@apply bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300;
361+
}
362+
363+
.kanban-color-emerald {
364+
@apply bg-emerald-100 text-emerald-700 dark:bg-emerald-900/50 dark:text-emerald-300;
365+
}
366+
367+
.kanban-color-teal {
368+
@apply bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300;
369+
}
370+
371+
.kanban-color-cyan {
372+
@apply bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300;
373+
}
374+
375+
.kanban-color-sky {
376+
@apply bg-sky-100 text-sky-700 dark:bg-sky-900/50 dark:text-sky-300;
377+
}
378+
379+
.kanban-color-blue {
380+
@apply bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300;
381+
}
382+
383+
.kanban-color-indigo {
384+
@apply bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300;
385+
}
386+
387+
.kanban-color-violet {
388+
@apply bg-violet-100 text-violet-700 dark:bg-violet-900/50 dark:text-violet-300;
389+
}
390+
391+
.kanban-color-purple {
392+
@apply bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300;
393+
}
394+
395+
.kanban-color-fuchsia {
396+
@apply bg-fuchsia-100 text-fuchsia-700 dark:bg-fuchsia-900/50 dark:text-fuchsia-300;
397+
}
398+
399+
.kanban-color-pink {
400+
@apply bg-pink-100 text-pink-700 dark:bg-pink-900/50 dark:text-pink-300;
401+
}
402+
403+
.kanban-color-rose {
404+
@apply bg-rose-100 text-rose-700 dark:bg-rose-900/50 dark:text-rose-300;
405+
}
406+
314407
/* Responsive Adaptations */
315408
@media (max-width: 640px) {
316409
.kanban-column {

0 commit comments

Comments
 (0)