phoebus_os/installer/live/desktop/common/Theme.qml
2026-09-26 10:08:47 -07:00

84 lines
3.7 KiB
Bash

pragma Singleton
import QtQuick
import Quickshell
// Phoebus brand tokens. Kept in sync with phoebus_core::brand::PALETTE by a
// Rust test, so the QML frontend and the backend cannot drift.
//
// Dark is the default (charcoal, warm white, amber). Light mode is available
// and the selection persists via `themeMode` (see shell.qml Preferences).
QtObject {
id: theme
// Palette: charcoal, warm white, restrained amber.
readonly property color charcoal: "#17171b"
readonly property color surface: "#232329"
readonly property color surfaceRaised: "#2b2b33"
readonly property color border: "#3a3a42"
readonly property color warmWhite: "#f4efe6"
readonly property color muted: "#a8a29a"
readonly property color amber: "#e8a33d"
readonly property color amberDeep: "#c97f24"
readonly property color success: "#7fb069"
readonly property color warning: "#e0a24a"
readonly property color danger: "#d2564b"
// Light palette (warm paper, readable contrast, visible focus).
readonly property color lightBackground: "#faf7f0"
readonly property color lightSurface: "#ffffff"
readonly property color lightSurfaceRaised: "#f0ebe0"
readonly property color lightBorder: "#d8d0c2"
readonly property color lightText: "#1c1c20"
readonly property color lightMuted: "#6b655c"
// `themeMode` is "dark" by default; shell.qml may set "light" and persist
// it through preferences. All surfaces read through these aliases.
property string themeMode: "dark"
readonly property bool isLight: themeMode === "light"
// Canonical tokens (used by shared components).
readonly property color background: isLight ? lightBackground : charcoal
readonly property color card: isLight ? lightSurface : surface
readonly property color cardHover: isLight ? lightSurfaceRaised : surfaceRaised
readonly property color text: isLight ? lightText : warmWhite
readonly property color primary: amber
readonly property color accent: isLight ? amberDeep : amber
readonly property color focusRing: amber
readonly property color overlay: Qt.rgba(0.09, 0.09, 0.10, 0.72)
// Text scale. `PHOEBUS_UI_SCALE` lets a display or accessibility setup
// enlarge everything; the content areas scroll, so a larger scale still
// fits at 1024x768.
readonly property real scale: {
const value = parseFloat(Quickshell.env("PHOEBUS_UI_SCALE"));
return (isNaN(value) || value < 0.5 || value > 4) ? 1.0 : value;
}
// Layout.
readonly property int radius: 12
readonly property int radiusSmall: 8
readonly property int gutter: 20
readonly property int pad: 16
readonly property int padLarge: 28
// Control sizing follows the text scale so labels never clip.
readonly property int controlHeight: Math.round(42 * scale)
readonly property int controlHeightLarge: Math.round(46 * scale)
readonly property int controlHeightCompact: Math.round(34 * scale)
readonly property int rowHeight: Math.round(30 * scale)
// Type scale.
readonly property int fontDisplay: Math.round(30 * scale)
readonly property int fontTitle: Math.round(22 * scale)
readonly property int fontHeading: Math.round(17 * scale)
readonly property int fontBody: Math.round(14 * scale)
readonly property int fontSmall: Math.round(12 * scale)
readonly property string family: "DejaVu Sans, Noto Sans, sans-serif"
// Branding assets installed by the live build.
readonly property string brandDir: "/usr/share/phoebus/branding"
readonly property string emblem: brandDir + "/emblem.svg"
readonly property string wordmark: brandDir + "/wordmark.svg"
readonly property string wallpaper: brandDir + "/wallpaper.svg"
}