🎨 (Account) Add contrast color to all styled component

This commit is contained in:
Julien Calixte
2019-10-26 22:13:01 +02:00
parent 91c98651dd
commit 44aab53963
5 changed files with 83 additions and 34 deletions

View File

@@ -3,6 +3,7 @@ import { Getter } from 'vuex-class'
import bus, { SYNC } from '@/utils/bus-event'
import IAccount from '@/models/IAccount'
import IUser from '@/models/IUser'
import { findContrastColor } from '@/utils'
@Component
export default class BaseAccount extends Vue {
@@ -25,6 +26,17 @@ export default class BaseAccount extends Vue {
}
}
public colorStyle(display: boolean = true) {
if (!this.account || !display) {
return {}
}
return {
backgroundColor: this.account.color,
borderColor: this.account.color,
color: findContrastColor(this.account.color)
}
}
public beforeDestroy(): void {
bus.$off(SYNC, this.getData)
}