Skip to content

Commit

Permalink
Added the ability to explicitly and implicitly select a theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Helldar committed Oct 5, 2020
1 parent 214932f commit cd4fa8c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
11 changes: 9 additions & 2 deletions config/pretty-routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@
],

/*
* Set a dark theme.
* Set a light or dark themes.
*
* Available:
* light - always chooses a light theme.
* dark - always chooses a dark theme.
* auto - automatic theme detection from browser.
*
* By default, auto
*/

'dark' => false,
'color_scheme' => 'auto',
];
15 changes: 14 additions & 1 deletion resources/views/routes.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,24 @@ class="deprecated"
deprecated: '@lang("Deprecated")'
};
const colorScheme = () => {
let value = "{{ config('pretty-routes.color_scheme', 'auto') }}";
switch (value) {
case 'dark':
return true;
case 'light':
return false;
default:
return (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
}
};
new Vue({
el: '#app',
vuetify: new Vuetify({
theme: {
dark: {{ config('pretty-routes.dark', false) ? 'true' : 'false' }}
dark: colorScheme()
}
}),
Expand Down

0 comments on commit cd4fa8c

Please sign in to comment.