hsluv/hsl(a) functions: wrap around hue

This commit is contained in:
miruka 2019-08-21 12:32:14 -04:00
parent 1886303481
commit 7624ce5fcb
2 changed files with 12 additions and 4 deletions

View File

@ -2,10 +2,11 @@
- Use HInterfaceBox for EditAccount Profile and Encryption - Use HInterfaceBox for EditAccount Profile and Encryption
- Banners - 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 - 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) - Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html)
- Choose a better default easing type for animations - Choose a better default easing type for animations
- Sendbox - Sendbox
@ -95,9 +96,8 @@
- Prevent using an alias if that user is not in the room or no permission - 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 - Spinner when loading account, past room events, images or clicking buttons
- Show account page as loading until profile initially retrieved - Show account page as loading until profile initially retrieved
- Theming - Theming
- Don't create additional lines in theme conversion (braces)
- Recursively merge default and user theme
- Distribute fonts - Distribute fonts
- preferredIconPack: accept multiple values - preferredIconPack: accept multiple values
- Find icon packs in user data dir - Find icon packs in user data dir
@ -107,6 +107,7 @@
- Way to round avatar corners to allow box radius - Way to round avatar corners to allow box radius
- If avatar is set, name color from average color? - If avatar is set, name color from average color?
- Accent color from background - Accent color from background
- Settings page - Settings page
- Message/text selection - Message/text selection
- Notifications - Notifications

View File

@ -1,4 +1,10 @@
function numberWrapAround(num, max) {
return num < 0 ? max + (num % max) : (num % max)
}
function hsluv(hue, saturation, lightness, alpha=1.0) { function hsluv(hue, saturation, lightness, alpha=1.0) {
hue = numberWrapAround(hue, 360)
let rgb = py.callSync("hsluv", [hue, saturation, lightness]) let rgb = py.callSync("hsluv", [hue, saturation, lightness])
return Qt.rgba(rgb[0], rgb[1], rgb[2], alpha) 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) { function hsla(hue, saturation, lightness, alpha=1.0) {
// Convert standard hsla(0-360, 1-100, 1-100, 0-1) to Qt format // 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) return Qt.hsla(hue / 360, saturation / 100, lightness / 100, alpha)
} }