void Theme::replaceLinkColorStringBackgroundAware(QString &linkString, const QColor &backgroundColor)
{
- linkString.replace(QRegularExpression("(<a href|<a style='color:#([a-zA-Z0-9]{6});' href)"), QString::fromLatin1("<a style='color:%1;' href").arg(getBackgroundAwareLinkColor(backgroundColor).name()));
+ replaceLinkColorString(linkString, getBackgroundAwareLinkColor(backgroundColor));
}
void Theme::replaceLinkColorStringBackgroundAware(QString &linkString)
replaceLinkColorStringBackgroundAware(linkString, QGuiApplication::palette().color(QPalette::Base));
}
+void Theme::replaceLinkColorString(QString &linkString, const QColor &newColor)
+{
+ linkString.replace(QRegularExpression("(<a href|<a style='color:#([a-zA-Z0-9]{6});' href)"), QString::fromLatin1("<a style='color:%1;' href").arg(newColor.name()));
+}
+
QIcon Theme::createColorAwareIcon(const QString &name, const QPalette &palette)
{
QImage img(name);
*/
static void replaceLinkColorStringBackgroundAware(QString &linkString);
+ /**
+ * @brief Appends a CSS-style colour value to all HTML link tags in a given string, as specified by newColor.
+ *
+ * 2019/12/19: Implemented for the Dark Mode on macOS, because the app palette can not account for that (Qt 5.12.5).
+ *
+ * This way we also avoid having certain strings re-translated on Transifex.
+ */
+ static void replaceLinkColorString(QString &linkString, const QColor &newColor);
+
/**
* @brief Creates a colour-aware icon based on the specified palette's base colour.
*