aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEvan Steinkerchner <esteinkerchner@gmail.com>2022-03-13 15:00:09 -0400
committerGitHub <noreply@github.com>2022-03-13 15:00:09 -0400
commit049610bc9178a57732356801e20488cf669eda5e (patch)
tree321d3bad29b06777514c1f0ea8f7ae07f32089b6
parentf3980069351ec91bea1999e5efff5c343a808706 (diff)
parent5db2414d052af629e2848f53ce9c2e0e686eefaf (diff)
downloadhomer-049610bc9178a57732356801e20488cf669eda5e.tar.gz
homer-049610bc9178a57732356801e20488cf669eda5e.tar.zst
homer-049610bc9178a57732356801e20488cf669eda5e.zip
Merge pull request #311 from Aryess/main
Fix #121 - Change default theme and layout from config
-rw-r--r--docs/configuration.md5
-rw-r--r--src/App.vue6
-rw-r--r--src/assets/defaults.yml6
-rw-r--r--src/components/DarkMode.vue14
-rw-r--r--src/components/SettingToggle.vue3
5 files changed, 33 insertions, 1 deletions
diff --git a/docs/configuration.md b/docs/configuration.md
index 552b22a..2083be3 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -31,6 +31,11 @@ connectivityCheck: true # whether you want to display a message when the apps ar
31proxy: 31proxy:
32 useCredentials: false # send cookies & authorization headers when fetching service specific data. Set to `true` if you use an authentication proxy. Can be overrided on service level. 32 useCredentials: false # send cookies & authorization headers when fetching service specific data. Set to `true` if you use an authentication proxy. Can be overrided on service level.
33 33
34# Set the default layout and color scheme
35defaults:
36 layout: columns # Either 'columns', or 'list'
37 colorTheme: auto # One of 'auto', 'light', or 'dark'
38
34# Optional theming 39# Optional theming
35theme: default # 'default' or one of the themes available in 'src/assets/themes'. 40theme: default # 'default' or one of the themes available in 'src/assets/themes'.
36 41
diff --git a/src/App.vue b/src/App.vue
index d2cb3ad..fda13c3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -30,13 +30,17 @@
30 :links="config.links" 30 :links="config.links"
31 @navbar-toggle="showMenu = !showMenu" 31 @navbar-toggle="showMenu = !showMenu"
32 > 32 >
33 <DarkMode @updated="isDark = $event" /> 33 <DarkMode
34 @updated="isDark = $event"
35 :defaultValue="this.config.defaults.colorTheme"
36 />
34 37
35 <SettingToggle 38 <SettingToggle
36 @updated="vlayout = $event" 39 @updated="vlayout = $event"
37 name="vlayout" 40 name="vlayout"
38 icon="fa-list" 41 icon="fa-list"
39 iconAlt="fa-columns" 42 iconAlt="fa-columns"
43 :defaultValue="this.config.defaults.layout == 'columns'"
40 /> 44 />
41 45
42 <SearchInput 46 <SearchInput
diff --git a/src/assets/defaults.yml b/src/assets/defaults.yml
index ed1fbc9..85f2698 100644
--- a/src/assets/defaults.yml
+++ b/src/assets/defaults.yml
@@ -10,6 +10,12 @@ footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a hre
10columns: 3 10columns: 3
11connectivityCheck: true 11connectivityCheck: true
12 12
13defaults:
14 # columns, list
15 layout: columns
16 # auto, light, dark
17 colorTheme: auto
18
13theme: default 19theme: default
14colors: 20colors:
15 light: 21 light:
diff --git a/src/components/DarkMode.vue b/src/components/DarkMode.vue
index 80491fa..677238a 100644
--- a/src/components/DarkMode.vue
+++ b/src/components/DarkMode.vue
@@ -15,6 +15,9 @@
15<script> 15<script>
16export default { 16export default {
17 name: "Darkmode", 17 name: "Darkmode",
18 props: {
19 defaultValue: String,
20 },
18 data: function () { 21 data: function () {
19 return { 22 return {
20 isDark: null, 23 isDark: null,
@@ -30,6 +33,17 @@ export default {
30 if ("overrideDark" in localStorage) { 33 if ("overrideDark" in localStorage) {
31 // Light theme is 1 and Dark theme is 2 34 // Light theme is 1 and Dark theme is 2
32 this.mode = JSON.parse(localStorage.overrideDark) ? 2 : 1; 35 this.mode = JSON.parse(localStorage.overrideDark) ? 2 : 1;
36 } else {
37 switch (this.defaultValue) {
38 case "light":
39 this.mode = 1;
40 break;
41 case "dark":
42 this.mode = 2;
43 break;
44 default:
45 this.mode = 0;
46 }
33 } 47 }
34 this.isDark = this.getIsDark(); 48 this.isDark = this.getIsDark();
35 this.$emit("updated", this.isDark); 49 this.$emit("updated", this.isDark);
diff --git a/src/components/SettingToggle.vue b/src/components/SettingToggle.vue
index 985ca84..6c8a10f 100644
--- a/src/components/SettingToggle.vue
+++ b/src/components/SettingToggle.vue
@@ -12,6 +12,7 @@ export default {
12 name: String, 12 name: String,
13 icon: String, 13 icon: String,
14 iconAlt: String, 14 iconAlt: String,
15 defaultValue: Boolean,
15 }, 16 },
16 data: function () { 17 data: function () {
17 return { 18 return {
@@ -24,6 +25,8 @@ export default {
24 25
25 if (this.name in localStorage) { 26 if (this.name in localStorage) {
26 this.value = JSON.parse(localStorage[this.name]); 27 this.value = JSON.parse(localStorage[this.name]);
28 } else {
29 this.value = this.defaultValue;
27 } 30 }
28 31
29 this.$emit("updated", this.value); 32 this.$emit("updated", this.value);