Skip to content

Commit a4e495a

Browse files
authored
fix Slack attachment button color looks wrong color for dark themes (#8959)
- Moved STATUS_COLORS declaration outside of the conditional block for better readability. - Updated hexColor assignment logic to ensure a default color is applied when buttonColor is not provided. - Adjusted customButtonStyle and customButtonTextStyle to use the updated hexColor logic.
1 parent 432cfb0 commit a4e495a

File tree

1 file changed

+8
-3
lines changed
  • app/components/post_list/post/body/content/message_attachments/action_button

1 file changed

+8
-3
lines changed

app/components/post_list/post/body/content/message_attachments/action_button/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,15 @@ const ActionButton = ({buttonColor, cookie, disabled, id, name, postId, theme}:
6464
}
6565
}, [serverUrl, postId, id, cookie]));
6666

67+
const STATUS_COLORS = getStatusColors(theme);
68+
let hexColor: string | undefined;
6769
if (buttonColor) {
68-
const STATUS_COLORS = getStatusColors(theme);
69-
const hexColor = secureGetFromRecord(STATUS_COLORS, buttonColor) || secureGetFromRecord(theme, buttonColor) || buttonColor;
70-
customButtonStyle = {borderColor: changeOpacity(hexColor, 0.25), backgroundColor: '#ffffff'};
70+
hexColor = secureGetFromRecord(STATUS_COLORS, buttonColor) || secureGetFromRecord(theme, buttonColor) || buttonColor;
71+
} else {
72+
hexColor = secureGetFromRecord(STATUS_COLORS, 'default');
73+
}
74+
if (hexColor) {
75+
customButtonStyle = {borderColor: changeOpacity(hexColor, 0.16), backgroundColor: changeOpacity(hexColor, 0.08), borderWidth: 0};
7176
customButtonTextStyle = {color: hexColor};
7277
}
7378

0 commit comments

Comments
 (0)