diff --git a/src/components/mobile/ColorSelectionSheet.vue b/src/components/mobile/ColorSelectionSheet.vue index ea6198a0..047fe6d1 100644 --- a/src/components/mobile/ColorSelectionSheet.vue +++ b/src/components/mobile/ColorSelectionSheet.vue @@ -11,7 +11,7 @@ diff --git a/src/components/mobile/IconSelectionSheet.vue b/src/components/mobile/IconSelectionSheet.vue index 48b41492..8a0f6890 100644 --- a/src/components/mobile/IconSelectionSheet.vue +++ b/src/components/mobile/IconSelectionSheet.vue @@ -10,7 +10,9 @@ - + diff --git a/src/components/mobile/ListItemSelectionSheet.vue b/src/components/mobile/ListItemSelectionSheet.vue index 21eee0aa..6751ed7a 100644 --- a/src/components/mobile/ListItemSelectionSheet.vue +++ b/src/components/mobile/ListItemSelectionSheet.vue @@ -16,7 +16,7 @@ @click="onItemClicked(item, index)"> diff --git a/src/components/mobile/TreeViewSelectionSheet.vue b/src/components/mobile/TreeViewSelectionSheet.vue index 63771724..bd39e01d 100644 --- a/src/components/mobile/TreeViewSelectionSheet.vue +++ b/src/components/mobile/TreeViewSelectionSheet.vue @@ -15,7 +15,7 @@ :label="primaryTitleField ? (primaryTitleI18n ? $t(item[primaryTitleField]) : item[primaryTitleField]) : (primaryTitleI18n ? $t(item) : item)"> diff --git a/src/components/mobile/TwoColumnListItemSelectionSheet.vue b/src/components/mobile/TwoColumnListItemSelectionSheet.vue index f3adec23..c56344aa 100644 --- a/src/components/mobile/TwoColumnListItemSelectionSheet.vue +++ b/src/components/mobile/TwoColumnListItemSelectionSheet.vue @@ -19,7 +19,7 @@ @click="onPrimaryItemClicked(item)"> @@ -37,7 +37,7 @@ @click="onSecondaryItemClicked(subItem)"> diff --git a/src/consts/color.js b/src/consts/color.js index 8c4faa3b..dbdbd5b5 100644 --- a/src/consts/color.js +++ b/src/consts/color.js @@ -17,6 +17,7 @@ const allAvailableColors = [ ]; export default { + defaultColor: defaultColor, allAccountColors: allAvailableColors, defaultAccountColor: defaultColor, allCategoryColors: allAvailableColors, diff --git a/src/filters/accountIconStyle.js b/src/filters/accountIconStyle.js new file mode 100644 index 00000000..d7864b05 --- /dev/null +++ b/src/filters/accountIconStyle.js @@ -0,0 +1,13 @@ +import colorConstants from '../consts/color.js'; + +export default function (color, defaultColor) { + if (color && color !== colorConstants.defaultAccountColor) { + color = '#' + color; + } else { + color = defaultColor; + } + + return { + color: color + }; +} diff --git a/src/filters/categoryIconStyle.js b/src/filters/categoryIconStyle.js new file mode 100644 index 00000000..46563b7b --- /dev/null +++ b/src/filters/categoryIconStyle.js @@ -0,0 +1,13 @@ +import colorConstants from '../consts/color.js'; + +export default function (color, defaultColor) { + if (color && color !== colorConstants.defaultCategoryColor) { + color = '#' + color; + } else { + color = defaultColor; + } + + return { + color: color + }; +} diff --git a/src/filters/defaultIconStyle.js b/src/filters/defaultIconStyle.js new file mode 100644 index 00000000..bf13d857 --- /dev/null +++ b/src/filters/defaultIconStyle.js @@ -0,0 +1,13 @@ +import colorConstants from '../consts/color.js'; + +export default function (color, defaultColor) { + if (color && color !== colorConstants.defaultColor) { + color = '#' + color; + } else { + color = defaultColor; + } + + return { + color: color + }; +} diff --git a/src/filters/iconStyle.js b/src/filters/iconStyle.js new file mode 100644 index 00000000..97c4e5f8 --- /dev/null +++ b/src/filters/iconStyle.js @@ -0,0 +1,13 @@ +import defaultIconStyle from "./defaultIconStyle.js"; +import accountIconStyle from "./accountIconStyle.js"; +import categoryIconStyle from "./categoryIconStyle.js"; + +export default function (color, iconType, defaultColor) { + if (iconType === 'account') { + return accountIconStyle(color, defaultColor); + } else if (iconType === 'category') { + return categoryIconStyle(color, defaultColor); + } else { + return defaultIconStyle(color, defaultColor); + } +} diff --git a/src/mobile-main.js b/src/mobile-main.js index e2495f15..63fdb15b 100644 --- a/src/mobile-main.js +++ b/src/mobile-main.js @@ -33,8 +33,11 @@ import webauthn from './lib/webauthn.js'; import utils from './lib/utils.js'; import currencyFilter from './filters/currency.js'; import iconFilter from './filters/icon.js'; +import iconStyleFilter from './filters/iconStyle.js'; import accountIconFilter from './filters/accountIcon.js'; +import accountIconStyleFilter from './filters/accountIconStyle.js'; import categoryIconFilter from './filters/categoryIcon.js'; +import categoryIconStyleFilter from './filters/categoryIconStyle.js'; import tokenDeviceFilter from './filters/tokenDevice.js'; import tokenIconFilter from './filters/tokenIcon.js'; @@ -207,8 +210,11 @@ Vue.prototype.$user = userstate; Vue.filter('currency', (value, currencyCode) => currencyFilter({ i18n }, value, currencyCode)); Vue.filter('icon', (value, iconType) => iconFilter(value, iconType)); +Vue.filter('iconStyle', (value, iconType, defaultColor) => iconStyleFilter(value, iconType, defaultColor)); Vue.filter('accountIcon', (value) => accountIconFilter(value)); +Vue.filter('accountIconStyle', (value, defaultColor) => accountIconStyleFilter(value, defaultColor)); Vue.filter('categoryIcon', (value) => categoryIconFilter(value)); +Vue.filter('categoryIconStyle', (value, defaultColor) => categoryIconStyleFilter(value, defaultColor)); Vue.filter('tokenDevice', (value) => tokenDeviceFilter(value)); Vue.filter('tokenIcon', (value) => tokenIconFilter(value)); diff --git a/src/views/mobile/accounts/Edit.vue b/src/views/mobile/accounts/Edit.vue index 4dd0d062..7c611651 100644 --- a/src/views/mobile/accounts/Edit.vue +++ b/src/views/mobile/accounts/Edit.vue @@ -91,7 +91,7 @@ @click="account.showIconSelectionSheet = true"> + :style="account.color | accountIconStyle('var(--default-icon-color)')"> + :style="account.color | accountIconStyle('var(--default-icon-color)')"> + :style="account.color | accountIconStyle('var(--default-icon-color)')"> + :style="account.color | accountIconStyle('var(--default-icon-color)')"> + :style="subAccount.color | accountIconStyle('var(--default-icon-color)')"> + :style="subAccount.color | accountIconStyle('var(--default-icon-color)')">
+ :style="account.color | accountIconStyle('var(--default-icon-color)')"> @@ -144,7 +144,7 @@ link="#" > + :style="subAccount.color | accountIconStyle('var(--default-icon-color)')"> diff --git a/src/views/mobile/categories/Default.vue b/src/views/mobile/categories/Default.vue index 9a648c1d..46e4eb3f 100644 --- a/src/views/mobile/categories/Default.vue +++ b/src/views/mobile/categories/Default.vue @@ -23,7 +23,7 @@ :title="$t('category.' + category.name, currentLocale)"> + :style="category.color | categoryIconStyle('var(--default-icon-color)')"> @@ -33,7 +33,7 @@ :title="$t('category.' + subCategory.name, currentLocale)"> + :style="subCategory.color | categoryIconStyle('var(--default-icon-color)')"> diff --git a/src/views/mobile/categories/Edit.vue b/src/views/mobile/categories/Edit.vue index 1d4781da..9221013c 100644 --- a/src/views/mobile/categories/Edit.vue +++ b/src/views/mobile/categories/Edit.vue @@ -41,7 +41,7 @@ @click="category.showIconSelectionSheet = true"> + :style="category.color | categoryIconStyle('var(--default-icon-color)')"> + :style="category.color | categoryIconStyle('var(--default-icon-color)')"> + :style="category.color | categoryIconStyle('var(--default-icon-color)')">