Skip to content

Commit 4597707

Browse files
committed
Dark mode UI
1 parent 1efd866 commit 4597707

File tree

3 files changed

+106
-43
lines changed

3 files changed

+106
-43
lines changed

src/assets/css/dark.css

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,41 @@
55
.dark .headerBlock .header {
66
color: #ffffff;
77
}
8+
.dark .headerBlock .icons-block a:hover{
9+
filter: invert(40%) sepia(94%) saturate(3371%) hue-rotate(227deg) brightness(99%) contrast(92%);
10+
}
811
.dark .headerBlock .icons-block a img {
912
filter: invert(100%) sepia(17%) saturate(0%) hue-rotate(24deg) brightness(103%) contrast(102%);
13+
}
14+
.dark .header-block {
15+
background-color: #616161;
16+
}
17+
.dark .tab-item .progress-bar{
18+
border: 1.5px rgb(107 107 107) solid;
19+
}
20+
.dark .tab-item:hover{
21+
border: 1px rgb(107 107 107) solid;
22+
}
23+
.dark .tab-item .links .link{
24+
filter: invert(100%) sepia(17%) saturate(0%) hue-rotate(24deg) brightness(103%) contrast(102%);
25+
}
26+
.dark .stats-block .block p{
27+
color: #b9b9b9;
28+
}
29+
.dark .stats-block .block .header {
30+
background-color: #595959;
31+
color: rgb(255 255 255);
32+
}
33+
.dark .stats-block.block .header{
34+
background-color: #595959;
35+
color: rgb(255 255 255);
36+
}
37+
.dark .stats-block.block p{
38+
color: #b9b9b9;
39+
}
40+
.dark .expander-body{
41+
background-color: #595959;
42+
}
43+
.dark .header span{
44+
color: rgb(255 255 255);
1045
}

src/components/DonutChart.vue

Lines changed: 61 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="chart">
3-
<Doughnut :data="data" :options="options" />
3+
<Doughnut :data="data" :options="options" v-if="data != undefined" />
44
</div>
55
</template>
66

@@ -14,57 +14,76 @@ export default {
1414
import { Doughnut } from 'vue-chartjs';
1515
import { Chart as ChartJS, ArcElement, Tooltip, Legend } from 'chart.js';
1616
import { convertSummaryTimeToString } from '../utils/converter';
17+
import { injecStorage } from '../storage/inject-storage';
18+
import { onMounted, ref } from 'vue';
19+
import { DARK_MODE_DEFAULT, StorageParams } from '../storage/storage-params';
1720
1821
const props = defineProps<{
1922
time: number[];
2023
labels: string[];
2124
}>();
2225
23-
ChartJS.register(ArcElement, Tooltip, Legend);
26+
const settingsStorage = injecStorage();
27+
const darkMode = ref();
28+
const data = ref();
29+
const options = ref();
2430
25-
const data = {
26-
labels: props.labels,
27-
datasets: [
28-
{
29-
backgroundColor: [
30-
'#5668e2',
31-
'#8a56e2',
32-
'#cf56e2',
33-
'#e256ae',
34-
'#e25668',
35-
'#e28956',
36-
'#e2cf56',
37-
'#d0ff82',
38-
'#aee256',
39-
'#68e256',
31+
onMounted(async () => {
32+
darkMode.value = await settingsStorage.getValue(StorageParams.DARK_MODE, DARK_MODE_DEFAULT);
33+
if (darkMode) {
34+
data.value = {
35+
labels: props.labels,
36+
datasets: [
37+
{
38+
borderWidth: 2,
39+
borderColor: darkMode.value ? '#303030' : '#fff',
40+
color: '#fff',
41+
backgroundColor: [
42+
'#5668e2',
43+
'#8a56e2',
44+
'#cf56e2',
45+
'#e256ae',
46+
'#e25668',
47+
'#e28956',
48+
'#e2cf56',
49+
'#d0ff82',
50+
'#aee256',
51+
'#68e256',
52+
],
53+
data: props.time,
54+
},
4055
],
41-
data: props.time,
42-
},
43-
],
44-
};
45-
46-
const options = {
47-
responsive: true,
48-
maintainAspectRatio: false,
49-
layout: {
50-
padding: 0,
51-
},
52-
plugins: {
53-
legend: {
54-
position: 'right',
55-
},
56-
legendDistance: {
57-
padding: 50,
58-
},
59-
tooltip: {
60-
callbacks: {
61-
label: function (context: any) {
62-
return convertSummaryTimeToString(context.raw);
56+
};
57+
options.value = {
58+
responsive: true,
59+
maintainAspectRatio: false,
60+
layout: {
61+
padding: 0,
62+
},
63+
plugins: {
64+
legend: {
65+
position: 'right',
66+
labels: {
67+
usePointStyle: true,
68+
color: darkMode.value ? '#a5a5a5' : '#7f7f7f',
69+
},
70+
},
71+
legendDistance: {
72+
padding: 50,
73+
},
74+
tooltip: {
75+
callbacks: {
76+
label: function (context: any) {
77+
return convertSummaryTimeToString(context.raw);
78+
},
79+
},
6380
},
6481
},
65-
},
66-
},
67-
};
82+
};
83+
}
84+
85+
ChartJS.register(ArcElement, Tooltip, Legend);
86+
});
6887
</script>
6988

7089
<style scoped>

src/pages/Popup.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ async function changeDarkMode(value: boolean) {
119119
await settingsStorage.saveValue(StorageParams.DARK_MODE, value);
120120
darkMode.value = value;
121121
applyDarkMode(value);
122+
updateTab();
123+
}
124+
125+
function updateTab() {
126+
const tempValue = activeTab.value;
127+
activeTab.value = undefined;
128+
setTimeout(() => {
129+
activeTab.value = tempValue;
130+
}, 50);
122131
}
123132
</script>
124133

@@ -148,7 +157,7 @@ async function changeDarkMode(value: boolean) {
148157
}
149158
150159
.headerBlock .icons-block a:hover {
151-
color: rgb(99, 99, 243);
160+
filter: invert(40%) sepia(94%) saturate(3371%) hue-rotate(227deg) brightness(99%) contrast(92%);
152161
}
153162
154163
.headerBlock .icons-block a {

0 commit comments

Comments
 (0)