23 lines
903 B
QML
23 lines
903 B
QML
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);
|
|
}
|
|
}
|