Skip to content

Commit

Permalink
Correctly set dark mode for guests including login views (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kovah committed Mar 16, 2023
1 parent 107571f commit 30e7d99
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/Helper/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,13 @@ function escapeSearchQuery(string $query): string
$query
);
}

/**
* Get a list of all routes that are accessible by guests.
*
* @return string[]
*/
function guestRoutes(): array
{
return ['guest/*', 'login', 'forgot-password', 'reset-password/*', 'two-factor-challenge', 'email/verify'];
}
6 changes: 6 additions & 0 deletions resources/assets/sass/_variables-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ $card-cap-bg: $darkmode-bg;
$card-bg: $darkmode-bg;


// Inputs
$input-group-addon-bg: $input-bg !default;
$input-group-addon-border-color: $input-border-color !default;


// List group
$list-group-bg: $darkmode-bg;
$list-group-color: $body-color;
Expand All @@ -167,6 +172,7 @@ $list-group-action-color: $white;
$list-group-action-active-color: $white;
$list-group-action-active-bg: $darkmode-bg-dark;


// Alerts
$alert-bg-level: +8;
$alert-border-level: +7;
Expand Down
4 changes: 2 additions & 2 deletions resources/views/partials/configure-darkmode.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@if(usersettings('darkmode_setting') === '1'
|| (request()->is('guest/*') && systemsettings('guest_darkmode_setting') === '1'))
|| (request()->is(...guestRoutes()) && systemsettings('guest_darkmode_setting') === '1'))
<link href="{{ mix('assets/dist/css/app-dark.css') }}" rel="stylesheet">
@elseif(usersettings('darkmode_setting') === '2'
|| (request()->is('guest/*') && systemsettings('guest_darkmode_setting') === '2'))
|| (request()->is(...guestRoutes()) && systemsettings('guest_darkmode_setting') === '2'))
<link rel="stylesheet" media="(prefers-color-scheme: light)" href="{{ mix('assets/dist/css/app.css') }}">
<link rel="stylesheet" media="(prefers-color-scheme: dark)" href="{{ mix('assets/dist/css/app-dark.css') }}">
@else
Expand Down

0 comments on commit 30e7d99

Please sign in to comment.