All singletons in Services/

This commit is contained in:
quadbyte 2025-08-09 18:02:18 -04:00
parent bce57c101a
commit 03af84e297
10 changed files with 0 additions and 9 deletions

52
Services/Style.qml Normal file
View file

@ -0,0 +1,52 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
Singleton {
id: root
/*
Preset sizes for font, radii, ?
*/
// Font
property real fontExtraLarge: 20
property real fontLarge: 14
property real fontMedium: 10
property real fontSmall: 8
// Font weight
property int fontWeightRegular: 400
property int fontWeightMedium: 500
property int fontWeightBold: 700
// Radii
property int radiusLarge: 20
property int radiusMedium: 16
property int radiusSmall: 12
// Border
property int borderThin: 1
property int borderMedium: 2
property int borderThick: 3
// Spacing
property int spacingExtraLarge: 20
property int spacingLarge: 16
property int spacingMedium: 12
property int spacingSmall: 8
// Animation duration (ms)
property int animationFast: 150
property int animationNormal: 300
property int animationSlow: 500
property int barHeight: 36
property int baseWidgetHeight: 32
property int sliderWidth: 200
property int tooltipDelay: 300
}

105
Services/Theme.qml Normal file
View file

@ -0,0 +1,105 @@
pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Io
import qs.Services
Singleton {
id: root
// Backgrounds
property color backgroundPrimary: themeData.backgroundPrimary
property color backgroundSecondary: themeData.backgroundSecondary
property color backgroundTertiary: themeData.backgroundTertiary
// Surfaces & Elevation
property color surface: themeData.surface
property color surfaceVariant: themeData.surfaceVariant
// Text Colors
property color textPrimary: themeData.textPrimary
property color textSecondary: themeData.textSecondary
property color textDisabled: themeData.textDisabled
// Accent Colors
property color accentPrimary: themeData.accentPrimary
property color accentSecondary: themeData.accentSecondary
property color accentTertiary: themeData.accentTertiary
// Error/Warning
property color error: themeData.error
property color warning: themeData.warning
// Highlights & Focus
property color highlight: themeData.highlight
property color rippleEffect: themeData.rippleEffect
// Additional Theme Properties
property color onAccent: themeData.onAccent
property color outline: themeData.outline
// Shadows & Overlays
property color shadow: applyOpacity(themeData.shadow, "B3")
property color overlay: applyOpacity(themeData.overlay, "66")
// Font Properties
property string fontFamily: "Roboto" // Family for all text
function applyOpacity(color, opacity) {
return color.replace("#", "#" + opacity)
}
// FileView to load theme data from JSON file
FileView {
id: themeFile
path: Settings.themeFile
watchChanges: true
onFileChanged: reload()
onAdapterUpdated: writeAdapter()
onLoadFailed: function (error) {
if (error.toString().includes("No such file") || error === 2) {
// File doesn't exist, create it with default values
writeAdapter()
}
}
JsonAdapter {
id: themeData
// Backgrounds
property string backgroundPrimary: "#191724"
property string backgroundSecondary: "#1f1d2e"
property string backgroundTertiary: "#26233a"
// Surfaces & Elevation
property string surface: "#1f1d2e"
property string surfaceVariant: "#37354c"
// Text Colors
property string textPrimary: "#e0def4"
property string textSecondary: "#908caa"
property string textDisabled: "#6e6a86"
// Accent Colors
property string accentPrimary: "#ebbcba"
property string accentSecondary: "#31748f"
property string accentTertiary: "#9ccfd8"
// Error/Warning
property string error: "#eb6f92"
property string warning: "#f6c177"
// Highlights & Focus
property string highlight: "#c4a7e7"
property string rippleEffect: "#9ccfd8"
// Additional Theme Properties
property string onAccent: "#191724"
property string outline: "#44415a"
// Shadows & Overlays
property string shadow: "#191724"
property string overlay: "#191724"
}
}
}