plugin: rust-side modules + theme services with serde-typed config
This commit is contained in:
parent
a86e90e927
commit
f34f3f2f4e
95 changed files with 2477 additions and 1011 deletions
23
shell/services/ThemeUtil.qml
Normal file
23
shell/services/ThemeUtil.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import NovaStats as NS
|
||||
import "." as S
|
||||
|
||||
// Helpers that need QML-side state (PowerProfileService) or compute over the
|
||||
// raw theme primitives. Plain values come straight from NS.ThemeService.
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Effective reduced-motion: configured value OR power-saver active.
|
||||
readonly property bool reducedMotion: NS.ThemeService.reducedMotionConfig || S.PowerProfileService.powerSaver
|
||||
|
||||
// Green -> yellow -> red gradient for 0-100% load/usage values.
|
||||
function loadColor(pct) {
|
||||
const t = Math.max(0, Math.min(100, pct)) / 100;
|
||||
const a = t < 0.5 ? NS.ThemeService.base0B : NS.ThemeService.base0A;
|
||||
const b = t < 0.5 ? NS.ThemeService.base0A : NS.ThemeService.base08;
|
||||
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
|
||||
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue