diff --git a/apps/web/src/app/auth/settings/account/change-avatar-dialog.component.ts b/apps/web/src/app/auth/settings/account/change-avatar-dialog.component.ts
index d41a2367e01..f4a2116eced 100644
--- a/apps/web/src/app/auth/settings/account/change-avatar-dialog.component.ts
+++ b/apps/web/src/app/auth/settings/account/change-avatar-dialog.component.ts
@@ -17,6 +17,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { Utils } from "@bitwarden/common/platform/misc/utils";
import {
+ AvatarDefaultColors,
DIALOG_DATA,
DialogConfig,
DialogRef,
@@ -48,18 +49,13 @@ export class ChangeAvatarDialogComponent implements OnInit, OnDestroy {
loading = false;
- // change palette to new colors
- defaultColorPalette: NamedAvatarColor[] = [
- { name: "brightBlue", color: "#16cbfc" },
- { name: "green", color: "#94cc4b" },
- { name: "orange", color: "#ffb520" },
- { name: "lavender", color: "#e5beed" },
- { name: "yellow", color: "#fcff41" },
- { name: "indigo", color: "#acbdf7" },
- { name: "teal", color: "#8ecdc5" },
- { name: "salmon", color: "#ffa3a3" },
- { name: "pink", color: "#ffa2d4" },
- ];
+ defaultColorPalette: NamedAvatarColor[] = AvatarDefaultColors.map((color) => {
+ return {
+ color,
+ name: this.i18nService.t(color === "brand" ? "blue" : color),
+ };
+ });
+
customColorSelected = false;
currentSelection: string;
@@ -79,9 +75,6 @@ export class ChangeAvatarDialogComponent implements OnInit, OnDestroy {
}
async ngOnInit() {
- //localize the default colors
- this.defaultColorPalette.forEach((c) => (c.name = this.i18nService.t(c.name)));
-
this.customColor$
.pipe(debounceTime(200), takeUntil(this.destroy$))
.subscribe((color: string | null) => {
@@ -104,13 +97,12 @@ export class ChangeAvatarDialogComponent implements OnInit, OnDestroy {
this.setSelection(this.customColor$.value);
}
- // does this get used anywhere?
- async generateAvatarColor() {
- Utils.stringToColor(this.profile.name.toString());
- }
-
submit = async () => {
- if (Utils.validateHexColor(this.currentSelection) || this.currentSelection == null) {
+ const defaultColorSelected = AvatarDefaultColors.includes(this.currentSelection);
+ const isValidHex = Utils.validateHexColor(this.currentSelection);
+ const isValidSelection = this.currentSelection == null || defaultColorSelected || isValidHex;
+
+ if (isValidSelection) {
await this.avatarService.setAvatarColor(this.currentSelection);
this.dialogRef.close();
this.toastService.showToast({
diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json
index fc2f463d9e6..1582ef34377 100644
--- a/apps/web/src/locales/en/messages.json
+++ b/apps/web/src/locales/en/messages.json
@@ -8221,6 +8221,15 @@
"pink": {
"message": "Pink"
},
+ "coral": {
+ "message": "Coral"
+ },
+ "purple": {
+ "message": "Purple"
+ },
+ "blue": {
+ "message": "Blue"
+ },
"customColor": {
"message": "Custom Color"
},
diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/settings/account.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/settings/account.component.html
index d5cab5c57e4..cc6993a0895 100644
--- a/bitwarden_license/bit-web/src/app/admin-console/providers/settings/account.component.html
+++ b/bitwarden_license/bit-web/src/app/admin-console/providers/settings/account.component.html
@@ -26,7 +26,7 @@
- // aaa
+