From 1934fce8bb5c68959f0c27353e9ae5419a1fcc98 Mon Sep 17 00:00:00 2001
From: Trevor Tabah <trevor.tabah@savoirfairelinux.com>
Date: Tue, 22 Jun 2021 18:05:03 -0400
Subject: [PATCH] hyperlink previews: add dark mode compatibility

Change-Id: Ic035092605e0f995f082c5859c1e58aabcc89a90
---
 src/constant/JamiTheme.qml                 | 6 ++++++
 src/mainview/components/MessageWebView.qml | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/constant/JamiTheme.qml b/src/constant/JamiTheme.qml
index d39931aec..ae6003568 100644
--- a/src/constant/JamiTheme.qml
+++ b/src/constant/JamiTheme.qml
@@ -152,6 +152,12 @@ Item {
     property color inviteHoverColor: darkTheme ? blackColor : whiteColor
     property color chatviewButtonColor: darkTheme ? whiteColor : blackColor
     property color bgTextInput: darkTheme ? "#060608" : whiteColor
+    property color previewTextContainerColor: darkTheme ? "#959595" : "#ececec"
+    property color previewTitleColor: darkTheme ? whiteColor : blackColor
+    property color previewSubtitleColor: darkTheme ? whiteColor : blackColor
+    property color previewImageBackgroundColor: whiteColor
+    property color previewCardContainerColor : darkTheme ? blackColor : whiteColor
+    property color previewUrlColor : darkTheme ? "#eeeeee" : "#333"
 
     // Font.
     property color faddedFontColor: darkTheme? "#c0c0c0" : "#a0a0a0"
diff --git a/src/mainview/components/MessageWebView.qml b/src/mainview/components/MessageWebView.qml
index 4f7531fe6..e6bfc9ab6 100644
--- a/src/mainview/components/MessageWebView.qml
+++ b/src/mainview/components/MessageWebView.qml
@@ -96,7 +96,13 @@ Rectangle {
             --placeholder-text-color:' + JamiTheme.placeholderTextColor + ';\
             --invite-hover-color:' + JamiTheme.inviteHoverColor + ';\
             --bg-text-input:' + JamiTheme.bgTextInput + ';\
-            --bg-invitation-rect:' + JamiTheme.bgInvitationRectColor + ';")'
+            --bg-invitation-rect:' + JamiTheme.bgInvitationRectColor + ';\
+            --preview-text-container-color:' + JamiTheme.previewTextContainerColor + ';\
+            --preview-title-color:' + JamiTheme.previewTitleColor + ';\
+            --preview-subtitle-color:' + JamiTheme.previewSubtitleColor + ';\
+            --preview-image-background-color:' + JamiTheme.previewImageBackgroundColor + ';\
+            --preview-card-container-color:' + JamiTheme.previewCardContainerColor + ';\
+            --preview-url-color:' + JamiTheme.previewUrlColor + ';")'
         messageWebView.runJavaScript("init_picker(" + JamiTheme.darkTheme + ");")
         messageWebView.runJavaScript(theme);
     }
-- 
GitLab