Set Dark Mode For Individual User ?

Hi, i wondering is that possible to create any function that let user to set their own filament theme default mode . i means light and dark mode ?
5 Replies
Vp
Vp5mo ago
https://filamentphp.com/docs/3.x/panels/themes#disabling-dark-mode Example:
// assuming darkModeSupport column has bool
return $panel
->darkMode(fn(): bool => auth()->user()->darkModeSupport);
// assuming darkModeSupport column has bool
return $panel
->darkMode(fn(): bool => auth()->user()->darkModeSupport);
Expecto Patronum
Expecto PatronumOP5mo ago
i means like . every user can set their own theme instead reflect to all user by depending on panel . Any ideas ?
Vp
Vp5mo ago
Actually I don't understand this question "set their own theme instead reflect to all user by depending on panel", can you rephrase again? your OP title, and descriptions ask different tho..
Expecto Patronum
Expecto PatronumOP5mo ago
sorry for the confusion . My question is how to let user can set their own theme from default filament theme mode . Because right now . filament have dark mode. so imagine i have few user . so every user can set their own mode to set light or dark mode for their own account .
Vp
Vp5mo ago
Ok, by default it's checking system theme (dark or light).. on user menu there is theme toggle to change theme using localStorage.. is that not enough or you want extra db call to replace this system mode? One thing that may achieve is to save prefer theme in users table, and then check it like my first answer.. otherwise I'm not sure Or like this (change default theme mode) https://filamentphp.com/docs/3.x/panels/themes#changing-the-default-theme-mode based on users preference read this link, they explain it clearly.. 🤣
Want results from more Discord servers?
Add your server