Skip to content

Commit 329a392

Browse files
committed
Hex color enhancements
1 parent c962ec3 commit 329a392

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

sormas-api/src/main/resources/validations.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,5 @@ systemConfigurationValueValidationNotAValidEmailsenderName = Value is not a vali
330330
systemConfigurationValueValidationNotAValidSmsSenderName = Value is not a valid name. Name should contain only letters and numbers without spaces & special characters. For more info please see https://developer.vonage.com/en/messaging/sms/guides/custom-sender-id .
331331
smsAuthKeyValueValidation = SMS Auth key value is not valid
332332
smsAuthSecretValueValidation = SMS Auth secret value is not valid
333-
systemConfigurationValueValidationInvalidBackgroundColor = Pre-defined values are: green, red, indigo, gray, default (case-sensitive) otherwise must match hexadecimal format, example: #dd2b0e or #4AA
333+
systemConfigurationValueValidationInvalidBackgroundColor = Pre-defined values are: green, red, indigo, gray, default (case-sensitive) otherwise must match hexadecimal format (with or without hash "#"), example: #dd2b0e or #4AA or dd2b0e
334334
systemConfigurationValueValidationMenuSubtitle = Can be empty or up to 16 (any) characters. Can be used to define name of the environment: PRODUCTION - TEST etc.

sormas-ui/src/main/java/de/symeda/sormas/ui/Menu.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,18 @@ private static void defineMenuSubtitleIfSystemConfigured(VerticalLayout topConta
214214
actualColorBackgroundColor = "#737278";
215215
break;
216216
default:
217-
actualColorBackgroundColor = backgroundColor;
217+
actualColorBackgroundColor = addHashIfMissing(backgroundColor);
218218
}
219219
return actualColorBackgroundColor;
220220
}
221221

222+
private static String addHashIfMissing(String backgroundColor) {
223+
if (!StringUtils.startsWith(backgroundColor, HASH)) {
224+
return HASH + backgroundColor;
225+
}
226+
return backgroundColor;
227+
}
228+
222229
private void showSettingsPopup() {
223230

224231
Window window = VaadinUiUtil.createPopupWindow();

0 commit comments

Comments
 (0)