Fixed toolbar colors for vuetify 2

This commit is contained in:
Stefan Zermatten
2021-03-28 14:29:56 +02:00
parent 60ae1ef604
commit 838e2ed35f
9 changed files with 51 additions and 33 deletions

View File

@@ -25,12 +25,14 @@
<script lang="js"> <script lang="js">
import isDarkColor from '/imports/ui/utility/isDarkColor.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js';
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
export default { export default {
props: { props: {
color: { color: {
type: String, type: String,
default(){ default(){
return this.$vuetify.theme.themes.light.secondary; return getThemeColor('secondary');
}, },
}, },
}, },

View File

@@ -123,6 +123,7 @@ import isDarkColor from '/imports/ui/utility/isDarkColor.js';
import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue'; import PropertyIcon from '/imports/ui/properties/shared/PropertyIcon.vue';
import { getPropertyName } from '/imports/constants/PROPERTIES.js'; import { getPropertyName } from '/imports/constants/PROPERTIES.js';
import ColorPicker from '/imports/ui/components/ColorPicker.vue'; import ColorPicker from '/imports/ui/components/ColorPicker.vue';
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
export default { export default {
components: { components: {
@@ -142,7 +143,7 @@ export default {
return isDarkColor(this.color); return isDarkColor(this.color);
}, },
color(){ color(){
return this.model && this.model.color || this.$vuetify.theme.themes.light.secondary; return this.model && this.model.color || getThemeColor('secondary');
}, },
title(){ title(){
let model = this.model; let model = this.model;

View File

@@ -129,6 +129,7 @@ import { assertEditPermission } from '/imports/api/creature/creaturePermissions.
import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js'; import { updateUserSharePermissions } from '/imports/api/sharing/sharing.js';
import isDarkColor from '/imports/ui/utility/isDarkColor.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js';
import CharacterSheetFab from '/imports/ui/creature/character/CharacterSheetFab.vue'; import CharacterSheetFab from '/imports/ui/creature/character/CharacterSheetFab.vue';
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
export default { export default {
inject: { inject: {
@@ -145,7 +146,7 @@ export default {
if (this.creature && this.creature.color){ if (this.creature && this.creature.color){
return this.creature.color; return this.creature.color;
} else { } else {
return this.$vuetify.theme.themes.light.secondary; return getThemeColor('secondary');
} }
}, },
isDark(){ isDark(){

View File

@@ -44,6 +44,7 @@
</template> </template>
<script lang="js"> <script lang="js">
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
import isDarkColor from '/imports/ui/utility/isDarkColor.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js';
export default { export default {
@@ -66,7 +67,7 @@
return isDarkColor(this.computedColor); return isDarkColor(this.computedColor);
}, },
computedColor(){ computedColor(){
return this.color || this.$vuetify.theme.themes.light.secondary; return this.color || getThemeColor('secondary');
} }
}, },
methods: { methods: {

View File

@@ -77,6 +77,7 @@ import InsertLibraryNodeButton from '/imports/ui/library/InsertLibraryNodeButton
import { getPropertyName } from '/imports/constants/PROPERTIES.js'; import { getPropertyName } from '/imports/constants/PROPERTIES.js';
import isDarkColor from '/imports/ui/utility/isDarkColor.js'; import isDarkColor from '/imports/ui/utility/isDarkColor.js';
import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js'; import { assertEditPermission } from '/imports/api/sharing/sharingPermissions.js';
import getThemeColor from '/imports/ui/utility/getThemeColor.js';
export default { export default {
components: { components: {
@@ -101,7 +102,7 @@ export default {
isToolbarDark(){ isToolbarDark(){
return isDarkColor( return isDarkColor(
this.selectedNode && this.selectedNode.color || this.selectedNode && this.selectedNode.color ||
this.$vuetify.theme.themes.light.secondary getThemeColor('secondary')
); );
} }
}, },

View File

@@ -4,7 +4,7 @@
} }
.theme--dark .card-background { .theme--dark .card-background {
background: #000; background: #151515;
} }
.theme--light .card-background { .theme--light .card-background {

View File

@@ -0,0 +1,7 @@
import vuetify from '/imports/ui/vuetify.js';
export default function(color){
return vuetify.framework.theme.dark ?
vuetify.framework.theme.themes.dark[color] :
vuetify.framework.theme.themes.light[color];
}

View File

@@ -5,27 +5,12 @@ import AppLayout from '/imports/ui/layouts/AppLayout.vue';
import ReactiveProvide from 'vue-reactive-provide'; import ReactiveProvide from 'vue-reactive-provide';
import VueObserverUtils from '@tozd/vue-observer-utils'; import VueObserverUtils from '@tozd/vue-observer-utils';
import router from '/imports/ui/router.js'; import router from '/imports/ui/router.js';
import themes from '/imports/ui/themes.js';
import '/imports/ui/components/global/globalIndex.js'; import '/imports/ui/components/global/globalIndex.js';
import SvgIconByName from '/imports/ui/icons/SvgIconByName.vue';
import SVG_ICONS from '/imports/constants/SVG_ICONS.js';
import '/imports/ui/markdownCofig.js'; import '/imports/ui/markdownCofig.js';
import vuetify from '/imports/ui/vuetify.js';
import Vuetify from 'vuetify/lib'; import Vuetify from 'vuetify/lib';
import { Scroll } from 'vuetify/lib/directives' import { Scroll } from 'vuetify/lib/directives'
let icons = {};
for (const name in SVG_ICONS) {
let icon = SVG_ICONS[name];
icons[icon.name] = {
component: SvgIconByName,
props: {
name: name,
}
}
}
Vue.use(VueMeteorTracker); Vue.use(VueMeteorTracker);
Vue.config.meteor.freeze = true; Vue.config.meteor.freeze = true;
Vue.config.devtools = true; Vue.config.devtools = true;
@@ -45,17 +30,7 @@ Meteor.startup(() => {
new Vue({ new Vue({
router, router,
store, store,
vuetify: new Vuetify({ vuetify,
theme: {
themes,
options: { variations: false },
//options: { customProperties: true },
},
icons: {
iconfont: 'md',
values: icons,
}
}),
...AppLayout, ...AppLayout,
}).$mount('#app'); }).$mount('#app');
}); });

30
app/imports/ui/vuetify.js Normal file
View File

@@ -0,0 +1,30 @@
import Vuetify from 'vuetify/lib';
import SVG_ICONS from '/imports/constants/SVG_ICONS.js';
import SvgIconByName from '/imports/ui/icons/SvgIconByName.vue';
import themes from '/imports/ui/themes.js';
let icons = {};
for (const name in SVG_ICONS) {
let icon = SVG_ICONS[name];
icons[icon.name] = {
component: SvgIconByName,
props: {
name: name,
}
}
}
let vuetify = new Vuetify({
theme: {
themes,
options: { variations: false },
//options: { customProperties: true },
},
icons: {
iconfont: 'md',
values: icons,
}
});
export default vuetify;