ShoyuVanilla / FoundryVTT-Chat-Portrait

Other
14 stars 24 forks source link

[BUG]Combat round message added by Monk's Little Detail doesn't render properly #121

Closed dstein766 closed 1 year ago

dstein766 commented 2 years ago

FVTT 10.288 DND5E 2.0.3 Chat Portrait 0.8.17 Monk's Little Details 10.2

Confirmed with Find The Culprit. Re-creation environment started with MLD 10.2, libcolorsettings 2.9.0, libchatcommands 1.4.0, and socketlib 1.0.12 locked ON and then continued from there.

MLD relevant setting is "Combat Round Messages: Add a chat message every round to delineate combat messages" turned ON.

Expected behavior: Spa9GAaZ4y

Observed behavior (only happens when Chat Portraits is active): G102oVGQxr

The chat text IS present - when CP is turned off the message is readable. So it appears to be some kind of styling issue only when CP is active.

dstein766 commented 2 years ago

FWIW, I brute-forced a solution by kludging up ChatPortrait.js as follows:

  static setChatMessageBackground(html, messageData, authorColor) {
        const useUserBackgroundColor = ChatPortrait.settings.useUserColorAsChatBackgroundColor;
        if (useUserBackgroundColor) {
            if(!html[0].getAttribute('class').includes("round-marker")) {
                html[0].style.background = "url(../ui/parchment.jpg) repeat";
                html[0].style.backgroundColor = authorColor;
            }
            //html[0].style.backgroundColor = authorColor;
            //@ts-ignore
            html[0].style.backgroundBlendMode = "screen";
        }
    }

Essentially, I figured out that MLD is using its own class to define the formatting of round markers but ChatPortrait overrides that later on when styling GM messages. Since I don't know how to do this elegantly via CSS I simply look at the class and when I see one that came from MLD I don't update the background or background color. The end result looks like the expected behavior (with the character and GM chat cards showing their appropriate player colors). pOzwcrCeXy

I'm sure this is REALLY awful and you can hopefully find a much better solution.