summary refs log tree commit diff
path: root/src/Utils.h
diff options
context:
space:
mode:
authorredsky17 <joedonofry@gmail.com>2019-02-07 23:15:25 +0000
committerredsky17 <joedonofry@gmail.com>2019-02-07 23:15:25 +0000
commitbb345a9a9f6ded16356f5e0607577bba089ccee4 (patch)
tree1fcdd6a4e6d9795853e43b3b235e845fe63a9c73 /src/Utils.h
parentMerge pull request #12 from rnhmjoj/fix-join (diff)
parentPrevent symlinks from overwriting files (diff)
downloadnheko-bb345a9a9f6ded16356f5e0607577bba089ccee4.tar.xz
Merge branch 'ui-enhancements'
Preparing for 0.6.3 release
Diffstat (limited to 'src/Utils.h')
-rw-r--r--src/Utils.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Utils.h b/src/Utils.h

index 2a029943..8672e7d4 100644 --- a/src/Utils.h +++ b/src/Utils.h
@@ -14,6 +14,8 @@ #include <mtx/events/collections.hpp> #include <mtx/events/common.hpp> +#include <qmath.h> + class QComboBox; namespace utils { @@ -227,6 +229,23 @@ markdownToHtml(const QString &text); QString linkColor(); +//! Returns the hash code of the input QString +int +hashQString(const QString &input); + +//! Generate a color (matching #RRGGBB) that has an acceptable contrast to background that is based +//! on the input string. +QString +generateContrastingHexColor(const QString &input, const QString &background); + +//! Given two luminance values, compute the contrast ratio between them. +qreal +computeContrast(const qreal &one, const qreal &two); + +//! Compute the luminance of a single color. Based on https://stackoverflow.com/a/9733420 +qreal +luminance(const QColor &col); + //! Center a widget in relation to another widget. void centerWidget(QWidget *widget, QWidget *parent);