diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-18 17:55:02 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-18 17:55:02 +0200 |
commit | a182706feb0f4112063f73a3cca8ef133cd2aa66 (patch) | |
tree | e653d8691edf7b0cd2db6c94978471dff87fb60b /test-client/visual.ts | |
parent | 4c135371e37a20d458a4cbbc48e2222b67c0f994 (diff) | |
download | hurrycurry-a182706feb0f4112063f73a3cca8ef133cd2aa66.tar hurrycurry-a182706feb0f4112063f73a3cca8ef133cd2aa66.tar.bz2 hurrycurry-a182706feb0f4112063f73a3cca8ef133cd2aa66.tar.zst |
colorize message if hint or error
Diffstat (limited to 'test-client/visual.ts')
-rw-r--r-- | test-client/visual.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test-client/visual.ts b/test-client/visual.ts index d63bee03..6802b2b4 100644 --- a/test-client/visual.ts +++ b/test-client/visual.ts @@ -221,6 +221,8 @@ function message_str(m: Message): string { return "[unknown message type]" } +const MESSAGE_BG = { "normal": "#fff", "hint": "#111", "error": "#fff" } +const MESSAGE_FG = { "normal": "#000", "hint": "#fff", "error": "#a00" } function draw_message(m: MessageData, server?: boolean) { ctx.save() ctx.translate(m.anim_position.x, m.anim_position.y) @@ -259,12 +261,12 @@ function draw_message(m: MessageData, server?: boolean) { if (!server) ctx.translate(0, -lines.length * 15 / 2) - ctx.fillStyle = "#fffa" + ctx.fillStyle = MESSAGE_BG[m.style] ctx.beginPath() ctx.roundRect(-w / 2, -5, w, lines.length * 15 + 10, 5) ctx.fill() - ctx.fillStyle = "black" + ctx.fillStyle = MESSAGE_FG[m.style] ctx.textAlign = "left" ctx.textBaseline = "top" for (let i = 0; i < lines.length; i++) |