暗黑模式调整

This commit is contained in:
fofolee 2022-05-17 00:13:47 +08:00
parent 3bdb72f435
commit 2c6076c5ee
7 changed files with 39 additions and 36 deletions

View File

@ -186,6 +186,14 @@ export default defineComponent({
.q-card--dark { .q-card--dark {
background: var(--q-dark-page); background: var(--q-dark-page);
} }
.container {
color: black;
background: white;
}
.body--dark .container {
color: white;
background: var(--q-dark-page);
}
.q-tooltip { .q-tooltip {
font-size: 11px; font-size: 11px;
} }

View File

@ -103,9 +103,6 @@
@click="handleCardClick" @click="handleCardClick"
v-ripple v-ripple
:class="{ [`text-${disabledColor}`]: !isCommandActivated }" :class="{ [`text-${disabledColor}`]: !isCommandActivated }"
:style="{
background: cardBgColor,
}"
> >
<q-card-section> <q-card-section>
<!-- logo --> <!-- logo -->
@ -317,9 +314,6 @@ export default {
disabledColor() { disabledColor() {
return this.$q.dark.isActive ? "grey-6" : "grey-5"; return this.$q.dark.isActive ? "grey-6" : "grey-5";
}, },
cardBgColor() {
return this.$q.dark.isActive ? "#ffffff08" : "#00000008";
},
featureCode() { featureCode() {
return this.commandInfo.features.code; return this.commandInfo.features.code;
}, },
@ -425,6 +419,10 @@ export default {
.q-card { .q-card {
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
background: #00000008;
}
.q-card--dark {
background: #ffffff08;
} }
.q-badge { .q-badge {
font-size: 15px; font-size: 15px;

View File

@ -1,11 +1,5 @@
<template> <template>
<div <div class="absolute-full container" style="overflow: 'hidden'">
class="absolute-full"
:style="{
background: $q.dark.isActive ? 'var(--q-dark-page)' : '#ffffff',
overflow: 'hidden',
}"
>
<!-- 命令设置栏 --> <!-- 命令设置栏 -->
<CommandSideBar <CommandSideBar
ref="sidebar" ref="sidebar"
@ -25,6 +19,7 @@
:style="{ :style="{
left: showSidebar ? sideBarWidth + 'px' : 65, left: showSidebar ? sideBarWidth + 'px' : 65,
zIndex: 1, zIndex: 1,
transition: '0.3s',
}" }"
> >
<div class="row" v-show="languageBarHeight"> <div class="row" v-show="languageBarHeight">
@ -34,12 +29,7 @@
flat flat
dense dense
color="primary" color="primary"
:style="{ class="menuBtn"
background: $q.dark.isActive
? 'rgba(255, 255, 255, 0.07)'
: 'rgba(0, 0, 0, 0.05)',
borderRadius: '0',
}"
icon="menu" icon="menu"
@click="toggleSideBarWidth" @click="toggleSideBarWidth"
><q-tooltip ><q-tooltip
@ -402,3 +392,13 @@ export default {
}, },
}; };
</script> </script>
<style scoped>
.menuBtn {
background: rgba(0, 0, 0, 0.05);
border-radius: 0;
}
.body--dark .menuBtn {
background: rgba(255, 255, 255, 0.07);
}
</style>

View File

@ -37,7 +37,6 @@ export default {
editor: null, editor: null,
value: null, value: null,
wordWrap: "off", wordWrap: "off",
shortCutKeyBg: this.$q.dark.isActive ? "#262626" : "#f3f4f6",
shortCuts: [ shortCuts: [
["保存", cmdCtrlKey, "S"], ["保存", cmdCtrlKey, "S"],
["运行", cmdCtrlKey, "B"], ["运行", cmdCtrlKey, "B"],
@ -52,9 +51,6 @@ export default {
rawEditor() { rawEditor() {
return toRaw(this.editor); return toRaw(this.editor);
}, },
isDark() {
return this.$q.dark.isActive;
},
}, },
props: { props: {
placeholder: Boolean, placeholder: Boolean,
@ -169,7 +165,7 @@ export default {
}); });
}, },
setEditorTheme() { setEditorTheme() {
monaco.editor.setTheme(this.isDark ? "vs-dark" : "vs"); monaco.editor.setTheme(this.$q.dark.isActive ? "vs-dark" : "vs");
}, },
getEditorValue() { getEditorValue() {
return this.rawEditor.getValue(); return this.rawEditor.getValue();
@ -269,10 +265,13 @@ export default {
user-select: none; user-select: none;
} }
.shortcut-key { .shortcut-key {
background-color: v-bind(shortCutKeyBg); background-color: #f3f4f6;
border-radius: 0.25rem; border-radius: 0.25rem;
margin-left: 0.5rem; margin-left: 0.5rem;
padding-left: 0.25rem; padding-left: 0.25rem;
padding-right: 0.25rem; padding-right: 0.25rem;
} }
.body--dark .shortcut-key {
background-color: #262626;
}
</style> </style>

View File

@ -228,7 +228,7 @@ export default {
.item-selected { .item-selected {
background: #dfe2e6; background: #dfe2e6;
} }
.item-selected.q-item--dark { .body--dark .item-selected {
background: #515151; background: #515151;
} }
</style> </style>

View File

@ -4,14 +4,13 @@
v-model="result" v-model="result"
:placeholder="options.placeholder" :placeholder="options.placeholder"
autofocus autofocus
class="fixed" class="fixed container"
:style="{ :style="{
top: 0, top: 0,
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
background: '#00000000', background: '#00000000',
color: $q.dark.isActive ? 'white' : 'black',
fontSize: '16px', fontSize: '16px',
outline: 'none', outline: 'none',
border: '3px solid #3577cb', border: '3px solid #3577cb',

View File

@ -7,13 +7,7 @@
v-for="count in currentPageCounts" v-for="count in currentPageCounts"
:key="count" :key="count"
> >
<q-card <q-card>
class="my-card"
:style="{
padding: '8px',
background: $q.dark.isActive ? '#ffffff08' : '#00000008',
}"
>
<q-item v-if="loading"> <q-item v-if="loading">
<q-item-section avatar> <q-item-section avatar>
<q-skeleton square width="48px" height="48px" animation="fade" /> <q-skeleton square width="48px" height="48px" animation="fade" />
@ -269,6 +263,11 @@ export default {
<style scoped> <style scoped>
.q-card { .q-card {
user-select: none; user-select: none;
padding: 8px;
background: #00000008;
}
.q-card--dark {
background: #ffffff08;
} }
.tag { .tag {
background: var(--q-primary); background: var(--q-primary);
@ -282,7 +281,7 @@ export default {
} }
.wrapper:hover { .wrapper:hover {
transition: 0.5s; transition: 0.5s;
transform: translateY(-1px); transform: scale(0.97);
filter: drop-shadow(1px 1px 5px #0000008e); filter: drop-shadow(1px 1px 5px #0000008e);
} }
</style> </style>