From 48ffee5fa78f44bd00d76772ad79ae4eeb6c8dc4 Mon Sep 17 00:00:00 2001 From: Alexey Andreyev Date: Wed, 15 May 2019 16:36:02 +0300 Subject: Move out the logic of the hue calculation to utils --- lib/util.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/util.h') diff --git a/lib/util.h b/lib/util.h index f08c1c95..eda817a1 100644 --- a/lib/util.h +++ b/lib/util.h @@ -314,5 +314,13 @@ namespace QMatrixClient * \param dir path to cache directory relative to the standard cache path */ QString cacheLocation(const QString& dirName); + + /** Hue color component of based of the hash of the string. + * The implementation is based on XEP-0392: + * https://xmpp.org/extensions/xep-0392.html + * Naming and range are the same as QColor's hueF method: + * https://doc.qt.io/qt-5/qcolor.html#integer-vs-floating-point-precision + */ + qreal stringToHueF(const QString& string); } // namespace QMatrixClient -- cgit v1.2.3