refactor: appearance fix typing

This commit is contained in:
2 * r + 2 * t 2025-04-28 20:13:35 +10:00
parent 0b48cc5ff6
commit 97b4b78d7e

View file

@ -9,20 +9,45 @@ Singleton {
id: root id: root
property bool borders: true property bool borders: true
readonly property Transparency transparency: Transparency {}
readonly property Rounding rounding: Rounding {}
readonly property Spacing spacing: Spacing {}
readonly property Padding padding: Padding {}
readonly property Font font: Font {}
readonly property Anim anim: Anim {}
readonly property Colours colours: Colours {}
readonly property QtObject transparency: QtObject { function alpha(c: color, layer: bool): color {
property real base: 0.78 return Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base);
property real layers: 0.5
} }
readonly property QtObject rounding: QtObject { FileView {
path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current.txt`
watchChanges: true
onFileChanged: this.reload()
onLoaded: {
const contents = this.text();
for (const line of contents.split("\n")) {
const [name, colour] = line.split(" ");
root.colours[name.trim()] = `#${colour.trim()}`;
}
}
}
component Transparency: QtObject {
readonly property real base: 0.78
readonly property real layers: 0.5
}
component Rounding: QtObject {
readonly property int small: 12 readonly property int small: 12
readonly property int normal: 17 readonly property int normal: 17
readonly property int large: 25 readonly property int large: 25
readonly property int full: 1000 readonly property int full: 1000
} }
readonly property QtObject spacing: QtObject { component Spacing: QtObject {
readonly property int small: 7 readonly property int small: 7
readonly property int smaller: 10 readonly property int smaller: 10
readonly property int normal: 12 readonly property int normal: 12
@ -30,7 +55,7 @@ Singleton {
readonly property int large: 20 readonly property int large: 20
} }
readonly property QtObject padding: QtObject { component Padding: QtObject {
readonly property int small: 5 readonly property int small: 5
readonly property int smaller: 7 readonly property int smaller: 7
readonly property int normal: 10 readonly property int normal: 10
@ -38,24 +63,26 @@ Singleton {
readonly property int large: 15 readonly property int large: 15
} }
readonly property QtObject font: QtObject { component FontFamily: QtObject {
readonly property QtObject family: QtObject {
readonly property string sans: "IBM Plex Sans" readonly property string sans: "IBM Plex Sans"
readonly property string mono: "JetBrains Mono NF" readonly property string mono: "JetBrains Mono NF"
readonly property string material: "Material Symbols Rounded" readonly property string material: "Material Symbols Rounded"
} }
readonly property QtObject size: QtObject { component FontSize: QtObject {
readonly property int small: 11 readonly property int small: 11
readonly property int smaller: 12 readonly property int smaller: 12
readonly property int normal: 13 readonly property int normal: 13
readonly property int larger: 15 readonly property int larger: 15
readonly property int large: 18 readonly property int large: 18
} }
component Font: QtObject {
readonly property FontFamily family: FontFamily {}
readonly property FontSize size: FontSize {}
} }
readonly property QtObject anim: QtObject { component AnimCurves: QtObject {
readonly property QtObject curves: QtObject {
readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1] readonly property list<real> emphasized: [0.05, 0, 2 / 15, 0.06, 1 / 6, 0.4, 5 / 24, 0.82, 0.25, 1, 1, 1]
readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1] readonly property list<real> emphasizedAccel: [0.3, 0, 0.8, 0.15, 1, 1]
readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1] readonly property list<real> emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1]
@ -64,15 +91,19 @@ Singleton {
readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1] readonly property list<real> standardDecel: [0, 0, 0, 1, 1, 1]
} }
readonly property QtObject durations: QtObject { component AnimDurations: QtObject {
readonly property int small: 200 readonly property int small: 200
readonly property int normal: 400 readonly property int normal: 400
readonly property int large: 600 readonly property int large: 600
readonly property int extraLarge: 1000 readonly property int extraLarge: 1000
} }
component Anim: QtObject {
readonly property AnimCurves curves: AnimCurves {}
readonly property AnimDurations durations: AnimDurations {}
} }
readonly property QtObject colours: QtObject { component Colours: QtObject {
property color primary: "#85D2E7" property color primary: "#85D2E7"
property color secondary: "#B2CBD3" property color secondary: "#B2CBD3"
property color tertiary: "#BFC4EB" property color tertiary: "#BFC4EB"
@ -105,22 +136,4 @@ Singleton {
property color blue: "#9CCBFA" property color blue: "#9CCBFA"
property color lavender: "#86D1EB" property color lavender: "#86D1EB"
} }
function alpha(c: color, layer: bool): color {
return Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base);
}
FileView {
path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current.txt`
watchChanges: true
onFileChanged: this.reload()
onLoaded: {
const contents = this.text();
for (const line of contents.split("\n")) {
const [name, colour] = line.split(" ");
root.colours[name.trim()] = `#${colour.trim()}`;
}
}
}
} }