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.
This commit is contained in:
ladudu 2025-09-17 18:44:55 +09:00 committed by GitHub
parent 432cfb08fe
commit a4e495a2a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,10 +64,15 @@ const ActionButton = ({buttonColor, cookie, disabled, id, name, postId, theme}:
}
}, [serverUrl, postId, id, cookie]));
const STATUS_COLORS = getStatusColors(theme);
let hexColor: string | undefined;
if (buttonColor) {
const STATUS_COLORS = getStatusColors(theme);
const hexColor = secureGetFromRecord(STATUS_COLORS, buttonColor) || secureGetFromRecord(theme, buttonColor) || buttonColor;
customButtonStyle = {borderColor: changeOpacity(hexColor, 0.25), backgroundColor: '#ffffff'};
hexColor = secureGetFromRecord(STATUS_COLORS, buttonColor) || secureGetFromRecord(theme, buttonColor) || buttonColor;
} else {
hexColor = secureGetFromRecord(STATUS_COLORS, 'default');
}
if (hexColor) {
customButtonStyle = {borderColor: changeOpacity(hexColor, 0.16), backgroundColor: changeOpacity(hexColor, 0.08), borderWidth: 0};
customButtonTextStyle = {color: hexColor};
}