Skip to content

Commit 66db915

Browse files
committed
Add dark mode, implements #75
1 parent d3e9699 commit 66db915

5 files changed

Lines changed: 64 additions & 7 deletions

File tree

quasar.conf.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ module.exports = function(ctx) {
2222
directives: [],
2323

2424
// Quasar plugins
25-
plugins: ["Notify", "Dialog"]
25+
plugins: ["Notify", "Dialog"],
26+
27+
config: {
28+
dark: 'auto'
29+
}
2630
},
2731

2832
supportIE: false,

src/components/display/Member.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div v-if="toObf === true && mojangData" style="overflow: auto">
44
<q-item-section>
5-
<q-item-label class="text-subtitle1" style="background-color: #d3d3d370">
5+
<q-item-label class="text-subtitle1 line-bg-color">
66
<div class="row">
77
<div class="col-1">Class:</div>
88
<div class="col-11 row">
@@ -47,7 +47,7 @@
4747

4848
<div v-else-if="toObf === false && mojangData" style="overflow: auto">
4949
<q-item-section>
50-
<q-item-label class="text-subtitle1" style="background-color: #d3d3d370">
50+
<q-item-label class="text-subtitle1 line-bg-color">
5151
<div class="row">
5252
<div class="col-1">Class:</div>
5353
<div class="col-11 row">
@@ -214,4 +214,18 @@
214214
.col-11.offset-1.row:nth-child(even) {
215215
background-color: #d3d3d370;
216216
}
217+
218+
.line-bg-color {
219+
background-color: #d3d3d370
220+
}
221+
222+
.body--dark {
223+
.col-11.offset-1.row:nth-child(even) {
224+
background-color: #44434370;
225+
}
226+
227+
.line-bg-color {
228+
background-color: #44434370
229+
}
230+
}
217231
</style>

src/components/display/Method.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
</span>
3333
</div>
3434
<div class="col-3" v-else style="color: gray">
35-
{{ mojangData.obf }}<span style="color: black">({{ mojangData.params }})</span>
35+
{{ mojangData.obf }}<span class="arg-color">({{ mojangData.params }})</span>
3636
</div>
3737
<div class="col-3" style="color: red">
38-
{{ mojangData.mapped }}<span style="color: black">({{ mojangData.params }})</span>
38+
{{ mojangData.mapped }}<span class="arg-color">({{ mojangData.params }})</span>
3939
</div>
4040
</template>
4141
</div>
@@ -61,8 +61,18 @@
6161
};
6262
</script>
6363

64-
<style scoped>
64+
<style scoped lang="scss">
6565
.col-3 {
6666
overflow-wrap: break-word;
6767
}
68+
69+
.arg-color {
70+
color: black;
71+
}
72+
73+
.body--dark {
74+
.arg-color {
75+
color: #cacaca;
76+
}
77+
}
6878
</style>

src/layouts/MainLayout.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
:width="200"
2424
:breakpoint="500"
2525
bordered
26-
content-class="bg-grey-3"
2726
>
2827
<q-scroll-area class="fit">
2928
<q-list padding>
@@ -45,6 +44,19 @@
4544
Spigot -> Mojang
4645
</q-item-section>
4746
</q-item>
47+
<q-item clickable v-ripple aria-label="Toggle Dark Mode" @click="toggleDark">
48+
<q-item-section avatar>
49+
<q-icon name="brightness_5" v-if="darkMode"/>
50+
<q-icon name="brightness_2" v-else />
51+
</q-item-section>
52+
53+
<q-item-section v-if="darkMode">
54+
Light Mode
55+
</q-item-section>
56+
<q-item-section v-else>
57+
Dark Mode
58+
</q-item-section>
59+
</q-item>
4860
</q-list>
4961
</q-scroll-area>
5062
</q-drawer>
@@ -67,9 +79,17 @@
6779
miniState: true
6880
};
6981
},
82+
computed: {
83+
darkMode() {
84+
return this.$q.dark.isActive;
85+
}
86+
},
7087
methods: {
7188
openUrl(url) {
7289
openURL(url);
90+
},
91+
toggleDark() {
92+
this.$q.dark.toggle();
7393
}
7494
}
7595
};

src/store/store-flag.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// THIS FEATURE-FLAG FILE IS AUTOGENERATED,
2+
// REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING
3+
import "quasar/dist/types/feature-flag";
4+
5+
declare module "quasar/dist/types/feature-flag" {
6+
interface QuasarFeatureFlags {
7+
store: true;
8+
}
9+
}

0 commit comments

Comments
 (0)