Skip to content

Commit

Permalink
Add auto night theme (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
joowdx authored Aug 25, 2021
1 parent 9293791 commit baa455f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion resources/views/head.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@

<!-- Start of Telescope Toolbar assets !-->
<script src="{{ route('telescope-toolbar.baseJs') }}?{{ $assetVersion }}"></script>
<link href="{{ route('telescope-toolbar.styling') }}?{{ $assetVersion }}&lightMode={{ $lightMode }}" rel="stylesheet">
@if ($lightMode !== 'auto')
<link href="{{ route('telescope-toolbar.styling') }}?{{ $assetVersion }}&lightMode={{ $lightMode }}" rel="stylesheet">
@else
<link href="{{ route('telescope-toolbar.styling') }}?{{ $assetVersion }}&lightMode=1" rel="stylesheet">
<link href="{{ route('telescope-toolbar.styling') }}?{{ $assetVersion }}&lightMode=0" media="(prefers-color-scheme: dark)" rel="stylesheet">
@endif
<script @if(isset($csp_script_nonce) && $csp_script_nonce) nonce="{{ $csp_script_nonce }}" @endif>/*<![CDATA[*/
(function () {
@foreach ($requestStack as $request)
Expand Down
3 changes: 2 additions & 1 deletion src/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private function injectToolbar($request, $response)

$head = View::make('telescope-toolbar::head', [
'assetVersion' => static::ASSET_VERSION,
'lightMode' => config('telescope-toolbar.light_theme') ? 1 : 0,
'lightMode' => config('telescope-toolbar.light_theme') === 'auto' ? 'auto'
: (config('telescope-toolbar.light_theme') ? 1 : 0),
'requestStack' => $this->getRequestStack($request, $response),
])->render();

Expand Down

0 comments on commit baa455f

Please sign in to comment.