diff --git a/TODO.md b/TODO.md index e4d549f1..a2c39bfd 100644 --- a/TODO.md +++ b/TODO.md @@ -2,10 +2,11 @@ - Use HInterfaceBox for EditAccount Profile and Encryption - Banners - - Make all icon SVG files white/black, since we can now use ColorOverlay + - Theming + - File format + - Make all icon SVG files white/black, since we can now use ColorOverlay - Make the icon blue in EditAccount when hovering and no avatar set - - `^property type name$` - Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html) - Choose a better default easing type for animations - Sendbox @@ -95,9 +96,8 @@ - Prevent using an alias if that user is not in the room or no permission - Spinner when loading account, past room events, images or clicking buttons - Show account page as loading until profile initially retrieved + - Theming - - Don't create additional lines in theme conversion (braces) - - Recursively merge default and user theme - Distribute fonts - preferredIconPack: accept multiple values - Find icon packs in user data dir @@ -107,6 +107,7 @@ - Way to round avatar corners to allow box radius - If avatar is set, name color from average color? - Accent color from background + - Settings page - Message/text selection - Notifications diff --git a/src/qml/utils.js b/src/qml/utils.js index 5f9c1fc4..aa661ef8 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -1,4 +1,10 @@ +function numberWrapAround(num, max) { + return num < 0 ? max + (num % max) : (num % max) +} + + function hsluv(hue, saturation, lightness, alpha=1.0) { + hue = numberWrapAround(hue, 360) let rgb = py.callSync("hsluv", [hue, saturation, lightness]) return Qt.rgba(rgb[0], rgb[1], rgb[2], alpha) } @@ -11,6 +17,7 @@ function hsl(hue, saturation, lightness) { function hsla(hue, saturation, lightness, alpha=1.0) { // Convert standard hsla(0-360, 1-100, 1-100, 0-1) to Qt format + hue = numberWrapAround(hue, 360) return Qt.hsla(hue / 360, saturation / 100, lightness / 100, alpha) }