🎨 (Account) Add contrast color to all styled component
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user