aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-25 01:06:08 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-10-25 01:06:08 +0200
commitcf244bb2b9571b64bdd9b9e9ec3ac4e74a213190 (patch)
tree091e0f03a2af068fbf3152595cdef99d8bc570bd /wee_slack.py
parent26eb1eb1957aa2a7a1d74a2dabb141958464a091 (diff)
downloadwee-slack-cf244bb2b9571b64bdd9b9e9ec3ac4e74a213190.tar.gz
Support color rich text elements
Fixes #912
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/wee_slack.py b/wee_slack.py
index 1709190..88949d9 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -4783,6 +4783,10 @@ def unfurl_block_rich_text_element(element):
return element["url"]
elif element["type"] == "emoji":
return replace_string_with_emoji(":{}:".format(element["name"]))
+ elif element["type"] == "color":
+ rgb_int = int(element["value"].lstrip("#"), 16)
+ weechat_color = w.info_get("color_rgb2term", str(rgb_int))
+ return "{} {}".format(element["value"], colorize_string(weechat_color, "■"))
elif element["type"] == "user":
return resolve_ref("@{}".format(element["user_id"]))
elif element["type"] == "usergroup":