mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Atempt better aura colour mix
This commit is contained in:
112
Cargo.lock
generated
112
Cargo.lock
generated
@@ -35,9 +35,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.10"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b"
|
||||
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
@@ -663,10 +663,11 @@ checksum = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.88"
|
||||
version = "1.0.89"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc"
|
||||
checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723"
|
||||
dependencies = [
|
||||
"jobserver",
|
||||
"libc",
|
||||
]
|
||||
|
||||
@@ -734,7 +735,7 @@ checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -850,7 +851,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"const-field-offset-macro",
|
||||
"field-offset",
|
||||
@@ -859,7 +860,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "const-field-offset-macro"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1151,7 +1152,7 @@ version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1801,7 +1802,7 @@ dependencies = [
|
||||
"glutin_glx_sys",
|
||||
"glutin_wgl_sys",
|
||||
"icrate",
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
"objc2",
|
||||
"once_cell",
|
||||
"raw-window-handle 0.5.2",
|
||||
@@ -1927,7 +1928,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
[[package]]
|
||||
name = "i-slint-backend-linuxkms"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"calloop",
|
||||
"drm",
|
||||
@@ -1947,7 +1948,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-qt"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-common",
|
||||
@@ -1959,7 +1960,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-selector"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"i-slint-backend-linuxkms",
|
||||
@@ -1972,7 +1973,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-backend-winit"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2005,18 +2006,18 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-common"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"derive_more",
|
||||
"fontdb",
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "i-slint-compiler"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"by_address",
|
||||
"codemap",
|
||||
@@ -2045,7 +2046,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-core"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"auto_enums",
|
||||
"bytemuck",
|
||||
@@ -2089,7 +2090,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-core-macros"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.52",
|
||||
@@ -2098,7 +2099,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-renderer-femtovg"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"const-field-offset",
|
||||
@@ -2129,7 +2130,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "i-slint-renderer-skia"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"cfg-if",
|
||||
@@ -2371,6 +2372,15 @@ version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.3.1"
|
||||
@@ -2382,9 +2392,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.68"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee"
|
||||
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -2456,9 +2466,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2caa5afb8bf9f3a2652760ce7d4f62d21c4d5a423e68466fca30df82f2330164"
|
||||
checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.4",
|
||||
@@ -3058,18 +3068,18 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0"
|
||||
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
|
||||
dependencies = [
|
||||
"pin-project-internal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-internal"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690"
|
||||
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3370,9 +3380,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.5"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -3873,7 +3883,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"i-slint-backend-selector",
|
||||
@@ -3889,7 +3899,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint-build"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"spin_on",
|
||||
@@ -3900,7 +3910,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "slint-macros"
|
||||
version = "1.5.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"i-slint-compiler",
|
||||
"proc-macro2",
|
||||
@@ -4291,7 +4301,7 @@ checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d"
|
||||
dependencies = [
|
||||
"as-raw-xcb-connection",
|
||||
"ctor",
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
@@ -4674,7 +4684,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"const-field-offset",
|
||||
"portable-atomic",
|
||||
@@ -4685,7 +4695,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vtable-macro"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git#42a407b6c72748b85e1e8d8401035c3274acfeb6"
|
||||
source = "git+https://github.com/flukejones/sixtyfps.git?branch=asusctl#f7ed950652302eca33f33e94a3bc503d710b4127"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4716,9 +4726,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.91"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f"
|
||||
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -4726,9 +4736,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.91"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b"
|
||||
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
@@ -4741,9 +4751,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.41"
|
||||
version = "0.4.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97"
|
||||
checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
@@ -4753,9 +4763,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.91"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed"
|
||||
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -4763,9 +4773,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.91"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66"
|
||||
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -4776,9 +4786,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.91"
|
||||
version = "0.2.92"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838"
|
||||
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
|
||||
|
||||
[[package]]
|
||||
name = "wayland-backend"
|
||||
@@ -4891,9 +4901,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.68"
|
||||
version = "0.3.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446"
|
||||
checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -5336,7 +5346,7 @@ dependencies = [
|
||||
"as-raw-xcb-connection",
|
||||
"gethostname 0.4.3",
|
||||
"libc",
|
||||
"libloading 0.8.2",
|
||||
"libloading 0.8.3",
|
||||
"once_cell",
|
||||
"rustix 0.38.31",
|
||||
"x11rb-protocol 0.13.0",
|
||||
|
||||
@@ -43,18 +43,20 @@ versions.workspace = true
|
||||
nix = "^0.26.1"
|
||||
tempfile = "3.3.0"
|
||||
|
||||
i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git" }
|
||||
i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git" }
|
||||
i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git" }
|
||||
i-slint-backend-selector = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" }
|
||||
i-slint-core = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" }
|
||||
i-slint-backend-winit = { git = "https://github.com/flukejones/sixtyfps.git", branch = "asusctl" }
|
||||
winit = "*"
|
||||
|
||||
[dependencies.slint]
|
||||
git = "https://github.com/flukejones/sixtyfps.git"
|
||||
branch = "asusctl"
|
||||
default-features = false
|
||||
features = ["std", "gettext", "compat-1-0", "backend-winit-wayland", "backend-linuxkms", "renderer-femtovg"]
|
||||
|
||||
[build-dependencies.slint-build]
|
||||
git = "https://github.com/flukejones/sixtyfps.git"
|
||||
branch = "asusctl"
|
||||
|
||||
[dev-dependencies]
|
||||
cargo-husky.workspace = true
|
||||
@@ -6,7 +6,7 @@ use rog_dbus::zbus_anime::AnimeProxy;
|
||||
use rog_dbus::zbus_aura::AuraProxy;
|
||||
use rog_dbus::zbus_platform::{PlatformProxy, PlatformProxyBlocking};
|
||||
use rog_platform::platform::Properties;
|
||||
use slint::{Color, ComponentHandle, Model, RgbaColor, SharedString, Weak};
|
||||
use slint::{ ComponentHandle, Model, RgbaColor, SharedString, Weak};
|
||||
use zbus::proxy::CacheProperties;
|
||||
|
||||
use crate::config::Config;
|
||||
@@ -405,61 +405,11 @@ fn decode_hex(s: &str) -> RgbaColor<u8> {
|
||||
red: *c.first().unwrap_or(&255),
|
||||
green: *c.get(1).unwrap_or(&128),
|
||||
blue: *c.get(2).unwrap_or(&32),
|
||||
.. Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
fn rgb_hi(colour: Color) -> (f32, f32) {
|
||||
let c1: RgbaColor<f32> = RgbaColor::from(colour);
|
||||
let r = c1.red / 255.0;
|
||||
let g = c1.green / 255.0;
|
||||
let b = c1.blue / 255.0;
|
||||
|
||||
let min = r.min(g.min(b));
|
||||
let max = r.max(g.max(b));
|
||||
let delta = max - min;
|
||||
|
||||
let h = match delta == 0.0 {
|
||||
true => 0.0,
|
||||
false => {
|
||||
if r == max {
|
||||
(g - b) / delta
|
||||
} else if g == max {
|
||||
2.0 + (b - r) / delta
|
||||
} else {
|
||||
4.0 + (r - g) / delta
|
||||
}
|
||||
}
|
||||
};
|
||||
let h2 = ((h * 60.0) + 360.0) % 360.0;
|
||||
let i = (c1.red + c1.green + c1.blue) / 3.0;
|
||||
(h2, i)
|
||||
}
|
||||
|
||||
fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
ui.global::<AuraPageData>().on_blend_colour(|c1, c2, f| {
|
||||
let c1: RgbaColor<f32> = RgbaColor::from(c1);
|
||||
let c2: RgbaColor<f32> = RgbaColor::from(c2);
|
||||
|
||||
let c1 = RgbaColor {
|
||||
alpha: 1.0,
|
||||
red: c1.red + (c2.red - c1.red) * f,
|
||||
green: c1.green + (c2.green - c1.green) * f,
|
||||
blue: c1.blue + (c2.blue - c1.blue) * f,
|
||||
};
|
||||
c1.into()
|
||||
});
|
||||
|
||||
ui.global::<AuraPageData>().on_blend_lightness(|c1, f| {
|
||||
let c1: RgbaColor<f32> = RgbaColor::from(c1);
|
||||
let c = RgbaColor {
|
||||
alpha: 1.0,
|
||||
red: c1.red * f,
|
||||
green: c1.green * f,
|
||||
blue: c1.blue * f,
|
||||
};
|
||||
c.into()
|
||||
});
|
||||
|
||||
ui.global::<AuraPageData>().on_set_hex_from_colour(|c| {
|
||||
format!("#{:02X}{:02X}{:02X}", c.red(), c.green(), c.blue()).into()
|
||||
});
|
||||
@@ -467,9 +417,6 @@ fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
ui.global::<AuraPageData>()
|
||||
.on_set_hex_to_colour(|s| decode_hex(s.as_str()).into());
|
||||
|
||||
ui.global::<AuraPageData>().on_set_hue(|c| rgb_hi(c).0);
|
||||
ui.global::<AuraPageData>().on_set_bright(|c| rgb_hi(c).1);
|
||||
|
||||
let handle = ui.as_weak();
|
||||
tokio::spawn(async move {
|
||||
let conn = zbus::Connection::system().await.unwrap();
|
||||
@@ -530,6 +477,8 @@ fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
"Keyboard LED mode set to {:?}",
|
||||
"Setting keyboard LED mode failed"
|
||||
);
|
||||
|
||||
handle.invoke_external_colour_change();
|
||||
})
|
||||
.ok();
|
||||
|
||||
@@ -546,6 +495,8 @@ fn setup_aura_page(ui: &MainWindow, _states: Arc<Mutex<Config>>) {
|
||||
handle
|
||||
.global::<AuraPageData>()
|
||||
.invoke_update_led_mode_data(out.into());
|
||||
handle
|
||||
.invoke_external_colour_change();
|
||||
})
|
||||
.ok();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-03-03 09:41+0000\n"
|
||||
"POT-Creation-Date: 2024-03-04 00:28+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
@@ -28,6 +28,11 @@ export component MainWindow inherits Window {
|
||||
show-notif = yes;
|
||||
fade-cover = yes;
|
||||
}
|
||||
callback external_colour_change();
|
||||
external_colour_change() => {
|
||||
aura.external_colour_change();
|
||||
aura.external_colour_change();
|
||||
}
|
||||
min-height: AppSize.height;
|
||||
min-width: AppSize.width;
|
||||
background: Colors.black;
|
||||
@@ -63,8 +68,9 @@ export component MainWindow inherits Window {
|
||||
height: root.height + 12px;
|
||||
}
|
||||
|
||||
if(side-bar.current-item == 1): PageAura {
|
||||
aura := PageAura {
|
||||
width: root.width - side-bar.width;
|
||||
visible: side-bar.current-item == 1;
|
||||
}
|
||||
|
||||
if(side-bar.current-item == 2): PageAnime {
|
||||
|
||||
@@ -103,18 +103,25 @@ export global AuraPageData {
|
||||
colorbox1 = data.colour1;
|
||||
colorbox2 = data.colour2;
|
||||
}
|
||||
callback blend_colour(color, color, float) -> color;
|
||||
callback blend_lightness(color, float) -> color;
|
||||
callback set_hex_from_colour(color) -> string;
|
||||
callback set_hex_to_colour(string) -> color;
|
||||
pure callback set_hue(color) -> float;
|
||||
pure callback set_bright(color) -> float;
|
||||
}
|
||||
|
||||
export component PageAura inherits VerticalLayout {
|
||||
padding: 10px;
|
||||
spacing: 10px;
|
||||
alignment: LayoutAlignment.start;
|
||||
callback external_colour_change();
|
||||
external_colour_change() => {
|
||||
c1.colourbox = AuraPageData.led_mode_data.colour1;
|
||||
c1.final_colour = AuraPageData.led_mode_data.colour1;
|
||||
c1.external_colour_change();
|
||||
|
||||
c2.colourbox = AuraPageData.led_mode_data.colour2;
|
||||
c2.final_colour = AuraPageData.led_mode_data.colour2;
|
||||
c2.external_colour_change();
|
||||
}
|
||||
|
||||
HorizontalLayout {
|
||||
spacing: 10px;
|
||||
SystemDropdown {
|
||||
@@ -152,31 +159,15 @@ export component PageAura inherits VerticalLayout {
|
||||
}
|
||||
|
||||
HorizontalBox {
|
||||
ColourSlider {
|
||||
c1:= ColourSlider {
|
||||
final_colour <=> AuraPageData.color1;
|
||||
colourbox <=> AuraPageData.colorbox1;
|
||||
set_hex_from_colour(c1) => {
|
||||
return AuraPageData.set_hex_from_colour(c1);
|
||||
}
|
||||
blend_colour(c1, c2, f) => {
|
||||
return AuraPageData.blend_colour(c1, c2, f);
|
||||
}
|
||||
blend_lightness(c1, f) => {
|
||||
return AuraPageData.blend_lightness(c1, f);
|
||||
}
|
||||
hex_to_colour(s) => {
|
||||
return AuraPageData.set_hex_to_colour(s);
|
||||
}
|
||||
set_hue(color) => {
|
||||
return AuraPageData.set_hue(color);
|
||||
}
|
||||
set_bright(color) => {
|
||||
return AuraPageData.set_bright(color);
|
||||
}
|
||||
init => {
|
||||
self.colourbox = AuraPageData.led_mode_data.colour1;
|
||||
self.final_colour = AuraPageData.led_mode_data.colour1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,28 +180,15 @@ export component PageAura inherits VerticalLayout {
|
||||
}
|
||||
|
||||
HorizontalBox {
|
||||
ColourSlider {
|
||||
c2:= ColourSlider {
|
||||
final_colour <=> AuraPageData.color2;
|
||||
colourbox <=> AuraPageData.colorbox2;
|
||||
set_hex_from_colour(c1) => {
|
||||
return AuraPageData.set_hex_from_colour(c1);
|
||||
}
|
||||
blend_colour(c1, c2, f) => {
|
||||
return AuraPageData.blend_colour(c1, c2, f);
|
||||
}
|
||||
blend_lightness(c1, f) => {
|
||||
return AuraPageData.blend_lightness(c1, f);
|
||||
}
|
||||
hex_to_colour(s) => {
|
||||
return AuraPageData.set_hex_to_colour(s);
|
||||
}
|
||||
set_bright(color) => {
|
||||
return AuraPageData.set_bright(color);
|
||||
}
|
||||
init => {
|
||||
self.colourbox = AuraPageData.led_mode_data.colour2;
|
||||
self.final_colour = AuraPageData.led_mode_data.colour2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,7 @@ export component ColourSlider inherits VerticalLayout {
|
||||
callback hex_to_colour(string) -> color;
|
||||
// required
|
||||
callback set_hex_from_colour(color) -> string;
|
||||
/// This callback is required until slint adds direct acces to color channels
|
||||
callback blend_colour(color, color, float) -> color;
|
||||
callback blend_lightness(color, float) -> color;
|
||||
pure callback set_hue(color) -> float;
|
||||
pure callback set_bright(color) -> float;
|
||||
|
||||
in-out property <float> c1value<=> c1.value;
|
||||
in-out property <float> c2value<=> c2.value;
|
||||
property <[color]> base_colours: [
|
||||
@@ -29,36 +25,46 @@ export component ColourSlider inherits VerticalLayout {
|
||||
Colors.rgb( 127, 0, 255),
|
||||
Colors.rgb( 255, 0, 255),
|
||||
Colors.rgb( 255, 0, 127),
|
||||
Colors.rgb( 128, 128, 128)
|
||||
// Colors.rgb( 128, 128, 128)
|
||||
];
|
||||
property <[color]> base_shade: [
|
||||
base_colour.with-alpha(100%),
|
||||
base_colour.with-alpha(90%),
|
||||
base_colour.with-alpha(80%),
|
||||
base_colour.with-alpha(70%),
|
||||
base_colour.with-alpha(60%),
|
||||
base_colour.with-alpha(50%),
|
||||
base_colour.with-alpha(40%),
|
||||
base_colour.with-alpha(30%),
|
||||
base_colour.with-alpha(20%),
|
||||
base_colour.with-alpha(10%),
|
||||
base_colour.with-alpha(0%)
|
||||
blend_lightness(base_colour, 1.0),
|
||||
blend_lightness(base_colour, 0.9),
|
||||
blend_lightness(base_colour, 0.8),
|
||||
blend_lightness(base_colour, 0.7),
|
||||
blend_lightness(base_colour, 0.6),
|
||||
blend_lightness(base_colour, 0.5),
|
||||
blend_lightness(base_colour, 0.4),
|
||||
blend_lightness(base_colour, 0.3),
|
||||
blend_lightness(base_colour, 0.2),
|
||||
blend_lightness(base_colour, 0.1),
|
||||
blend_lightness(base_colour, 0.0)
|
||||
];
|
||||
|
||||
function blend_lightness(c1: color, f: float) -> color {
|
||||
rgb(c1.red() * f, c1.green() * f, c1.blue() * f)
|
||||
}
|
||||
|
||||
function set_base_colour() {
|
||||
root.base_colour = blend_colour(base_colours[c1.value], base_colours[c1.value + 1], c1.value - Math.floor(c1.value));
|
||||
root.final_colour = blend_lightness(base_colour, (base_shade.length - c2.value) / base_shade.length);
|
||||
root.base_colour = base_colours[c1.value].linear-blend(base_colours[c1.value + 1], c1.value - Math.floor(c1.value));
|
||||
root.final_colour = blend_lightness(base_colour, ((base_shade.length - c2.value) / base_shade.length));
|
||||
root.colourbox = root.final_colour;
|
||||
}
|
||||
callback external_colour_change();
|
||||
external_colour_change => {
|
||||
c1.value = 13 * (root.set_hue(root.final_colour) / 360);
|
||||
c2.value = 11 - (11 * (root.set_bright(root.final_colour) / 0.5));
|
||||
if (root.final_colour.hue() < 0) {
|
||||
c1.value = (root.base_colours.length) * ((root.final_colour.hue() + 360) / 360);
|
||||
} else {
|
||||
c1.value = (root.base_colours.length) * (root.final_colour.hue() / 360);
|
||||
}
|
||||
c2.value = root.base_shade.length - (root.base_shade.length * root.final_colour.brightness());
|
||||
root.set_base_colour();
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
// 13 colours
|
||||
background: @linear-gradient(90deg, base_colours[0], base_colours[1], base_colours[2], base_colours[3], base_colours[4], base_colours[5], base_colours[6], base_colours[7], base_colours[8], base_colours[9], base_colours[10], base_colours[11], base_colours[12]);
|
||||
background: @linear-gradient(90deg, base_colours[0], base_colours[1], base_colours[2], base_colours[3], base_colours[4], base_colours[5], base_colours[6], base_colours[7], base_colours[8], base_colours[9], base_colours[10], base_colours[11]); //, base_colours[12]);
|
||||
clip: true;
|
||||
border-radius: 6px;
|
||||
c1 := Slider {
|
||||
@@ -70,9 +76,6 @@ export component ColourSlider inherits VerticalLayout {
|
||||
set_base_colour();
|
||||
hex = set_hex_from_colour(final_colour);
|
||||
}
|
||||
init => {
|
||||
self.value = 13 * (root.set_hue(root.final_colour) / 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +94,6 @@ export component ColourSlider inherits VerticalLayout {
|
||||
set_base_colour();
|
||||
hex = set_hex_from_colour(final_colour);
|
||||
}
|
||||
init => {
|
||||
self.value = 12 - (12 * (root.set_bright(root.final_colour) / 0.5));
|
||||
root.set_base_colour();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,6 +110,7 @@ export component ColourSlider inherits VerticalLayout {
|
||||
Rectangle {
|
||||
width: self.height;
|
||||
background <=> root.colourbox;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user