adapt Colors.qml to pull in colors from stylix
This commit is contained in:
parent
1d96e74bb6
commit
16343346ab
5 changed files with 98 additions and 86 deletions
84
Colors.qml
84
Colors.qml
|
|
@ -1,26 +1,72 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
pragma Singleton
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
QtObject {
|
||||
// --- The Backgrounds (Darkest to Lightest) ---
|
||||
readonly property color base00: "#1e1e2e" // Default Background
|
||||
readonly property color base01: "#181825" // Lighter Background (Status bars, panels)
|
||||
readonly property color base02: "#313244" // Selection Background
|
||||
readonly property color base03: "#45475a" // Comments, Invisibles, line highlighting
|
||||
readonly property color base00: "#" + viewer.base00
|
||||
readonly property color base01: "#" + viewer.base01
|
||||
readonly property color base02: "#" + viewer.base02
|
||||
readonly property color base03: "#" + viewer.base03
|
||||
readonly property color base04: "#" + viewer.base04
|
||||
readonly property color base05: "#" + viewer.base05
|
||||
readonly property color base06: "#" + viewer.base06
|
||||
readonly property color base07: "#" + viewer.base07
|
||||
readonly property color base08: "#" + viewer.base08
|
||||
readonly property color base09: "#" + viewer.base09
|
||||
readonly property color base0A: "#" + viewer.base0A
|
||||
readonly property color base0B: "#" + viewer.base0B
|
||||
readonly property color base0C: "#" + viewer.base0C
|
||||
readonly property color base0D: "#" + viewer.base0D
|
||||
readonly property color base0E: "#" + viewer.base0E
|
||||
readonly property color base0F: "#" + viewer.base0F
|
||||
|
||||
// --- The Foregrounds (Darkest to Lightest) ---
|
||||
readonly property color base04: "#585b70" // Dark Foreground (Used for status bars)
|
||||
readonly property color base05: "#cdd6f4" // Default Foreground, Caret
|
||||
readonly property color base06: "#f5e0dc" // Light Foreground (Rarely used)
|
||||
readonly property color base07: "#b4befe" // Lightest Foreground
|
||||
FileView {
|
||||
id: viewer
|
||||
path: `${Quickshell.env("HOME")}/.config/stylix/palette.json`
|
||||
watchChanges: true
|
||||
onFileChanged: reload()
|
||||
blockLoading: true // colors resolved before first paint, no flash of defaults
|
||||
property alias base00: palette.base00
|
||||
property alias base01: palette.base01
|
||||
property alias base02: palette.base02
|
||||
property alias base03: palette.base03
|
||||
property alias base04: palette.base04
|
||||
property alias base05: palette.base05
|
||||
property alias base06: palette.base06
|
||||
property alias base07: palette.base07
|
||||
property alias base08: palette.base08
|
||||
property alias base09: palette.base09
|
||||
property alias base0A: palette.base0A
|
||||
property alias base0B: palette.base0B
|
||||
property alias base0C: palette.base0C
|
||||
property alias base0D: palette.base0D
|
||||
property alias base0E: palette.base0E
|
||||
property alias base0F: palette.base0F
|
||||
|
||||
// --- The Accent Colors ---
|
||||
readonly property color base08: "#f38ba8" // Red (Variables, errors)
|
||||
readonly property color base09: "#fab387" // Orange (Integers, booleans, constants)
|
||||
readonly property color base0A: "#f9e2af" // Yellow (Classes, search text bg, warnings)
|
||||
readonly property color base0B: "#a6e3a1" // Green (Strings, success states)
|
||||
readonly property color base0C: "#94e2d5" // Cyan (Support, regex, escape chars)
|
||||
readonly property color base0D: "#89b4fa" // Blue (Functions, methods, headings)
|
||||
readonly property color base0E: "#cba6f7" // Purple/Mauve (Keywords, storage, selectors)
|
||||
readonly property color base0F: "#f2cdcd" // Brown/Flamingo (Deprecated, embedded tags)
|
||||
JsonAdapter {
|
||||
id: palette
|
||||
// strings, not colors — QML coerces "#rrggbb" -> color at the readonly props above
|
||||
property string base00
|
||||
property string base01
|
||||
property string base02
|
||||
property string base03
|
||||
property string base04
|
||||
property string base05
|
||||
property string base06
|
||||
property string base07
|
||||
property string base08
|
||||
property string base09
|
||||
property string base0A
|
||||
property string base0B
|
||||
property string base0C
|
||||
property string base0D
|
||||
property string base0E
|
||||
property string base0F
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue