🎨 (Color) add contrast color
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
>
|
||||
<router-link
|
||||
:class="{ 'is-primary': !account.color, 'is-white': account.color }"
|
||||
:style="`color: ${findDarkValue(account.color)}`"
|
||||
:style="`color: ${findContrastColor(account.color)}`"
|
||||
:to="{ name: 'account', params: { id: account._id } }"
|
||||
>{{ account.name }}</router-link
|
||||
>
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator'
|
||||
import { findDarkValue } from '@/utils'
|
||||
import { findContrastColor, findDarkValue } from '@/utils'
|
||||
import bus, { SYNC } from '@/utils/bus-event'
|
||||
import accountService from '@/services/AccountService'
|
||||
import IAccount from '@/models/IAccount'
|
||||
@@ -45,8 +45,8 @@ export default class AccountCard extends Vue {
|
||||
)
|
||||
}
|
||||
|
||||
public findDarkValue(color: string): string | null {
|
||||
return findDarkValue(color)
|
||||
public findContrastColor(color: string): string | null {
|
||||
return findContrastColor(color)
|
||||
}
|
||||
|
||||
public goToAccount(id: string): void {
|
||||
@@ -59,7 +59,7 @@ export default class AccountCard extends Vue {
|
||||
}
|
||||
return {
|
||||
backgroundColor: color,
|
||||
color: this.findDarkValue(color)
|
||||
color: this.findContrastColor(color)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from 'vue-property-decorator'
|
||||
import { Getter } from 'vuex-class'
|
||||
import { findDarkValue } from '@/utils'
|
||||
import { findContrastColor } from '@/utils'
|
||||
import bus, { SYNC } from '@/utils/bus-event'
|
||||
import accountService from '@/services/AccountService'
|
||||
import IAccount from '@/models/IAccount'
|
||||
|
||||
@@ -170,7 +170,7 @@ import transactionService from '@/services/TransactionService'
|
||||
import formatDate from '@/utils/format-date'
|
||||
import notif from '@/utils/notif'
|
||||
import { money } from '@/utils/filters'
|
||||
import { confirmation, alertMessage, findDarkValue } from '@/utils'
|
||||
import { confirmation, alertMessage, findContrastColor } from '@/utils'
|
||||
|
||||
const today: Date = new Date()
|
||||
|
||||
@@ -302,7 +302,7 @@ export default class TransactionCreate extends Vue {
|
||||
}
|
||||
return {
|
||||
backgroundColor: this.account.color,
|
||||
color: findDarkValue(this.account.color) || 'black'
|
||||
color: findContrastColor(this.account.color) || 'black'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user