diff --git a/src/qml/Base/HAvatar.qml b/src/qml/Base/HAvatar.qml index 91b2a4f5..1ede68cc 100644 --- a/src/qml/Base/HAvatar.qml +++ b/src/qml/Base/HAvatar.qml @@ -15,7 +15,7 @@ Rectangle { opacity: hidden ? 0 : 1 - color: name ? Utils.avatarHue(name) : HStyle.avatar.background.unknown + color: name ? Utils.avatarColor(name) : HStyle.avatar.background.unknown HLabel { z: 1 diff --git a/src/qml/Chat/Timeline/EventContent.qml b/src/qml/Chat/Timeline/EventContent.qml index 684d5b47..7a33e8e1 100644 --- a/src/qml/Chat/Timeline/EventContent.qml +++ b/src/qml/Chat/Timeline/EventContent.qml @@ -41,7 +41,7 @@ Row { id: nameLabel text: senderInfo.displayName || model.senderId - color: Utils.nameHue(avatar.name) + color: Utils.nameColor(avatar.name) elide: Text.ElideRight maximumLineCount: 1 horizontalAlignment: isOwn ? Text.AlignRight : Text.AlignLeft diff --git a/src/qml/utils.js b/src/qml/utils.js index c7783cf5..21d72a6e 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -20,7 +20,7 @@ function hueFrom(string) { } -function avatarHue(name) { // TODO: bad name +function avatarColor(name) { return Qt.hsla( hueFrom(name), HStyle.avatar.background.saturation, @@ -30,7 +30,7 @@ function avatarHue(name) { // TODO: bad name } -function nameHue(name) { // TODO: bad name +function nameColor(name) { return Qt.hsla( hueFrom(name), HStyle.displayName.saturation, @@ -41,9 +41,9 @@ function nameHue(name) { // TODO: bad name function coloredNameHtml(name, alt_id) { - return "" + - escapeHtml(name || alt_id) + - "" + return "" + + escapeHtml(name || alt_id) + + "" }