From a48b21edfb60e6b7fc2e63fd84bd476adb065c5b Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 4 Feb 2020 10:00:07 +0100 Subject: [PATCH] Added color workaround --- app/src/main/java/eu/faircode/email/HtmlHelper.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index c6bcd37df3..92a7f32925 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -673,9 +673,13 @@ public class HtmlHelper { try { if (TextUtils.isEmpty(c)) return null; - else if (c.startsWith("#")) - color = Integer.decode(c) | 0xFF000000; - else if (c.startsWith("rgb") || c.startsWith("hsl")) { + else if (c.startsWith("#")) { + String code = c.substring(1); + if (x11ColorMap.containsKey(code)) // workaround + color = x11ColorMap.get(code) | 0xFF000000; + else + color = Integer.decode(c) | 0xFF000000; + } else if (c.startsWith("rgb") || c.startsWith("hsl")) { int s = c.indexOf("("); int e = c.indexOf(")"); if (s > 0 && e > s) { @@ -706,6 +710,7 @@ public class HtmlHelper { try { color = Color.parseColor(c); } catch (IllegalArgumentException ex) { + // Workaround color = Integer.decode("#" + c) | 0xFF000000; }