Renamed all services to xxxService. Moved a couple things in Commons
This commit is contained in:
parent
7e334ae768
commit
83ff5f5589
86 changed files with 275 additions and 211 deletions
|
|
@ -1,132 +0,0 @@
|
|||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Services
|
||||
|
||||
// --------------------------------
|
||||
// Noctalia Colors - Material Design 3
|
||||
// We only use a very small subset of all available m3 colors to avoid complexity
|
||||
// All color names start with a 'm' to avoid QML assuming some of them are signals (ex: onPrimary)
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
// --- Key Colors: These are the main accent colors that define your app's style
|
||||
property color mPrimary: customColors.mPrimary
|
||||
property color mOnPrimary: customColors.mOnPrimary
|
||||
property color mSecondary: customColors.mSecondary
|
||||
property color mOnSecondary: customColors.mOnSecondary
|
||||
property color mTertiary: customColors.mTertiary
|
||||
property color mOnTertiary: customColors.mOnTertiary
|
||||
|
||||
// --- Utility Colors: These colors serve specific, universal purposes like indicating errors
|
||||
property color mError: customColors.mError
|
||||
property color mOnError: customColors.mOnError
|
||||
|
||||
// --- Surface and Variant Colors: These provide additional options for surfaces and their contents, creating visual hierarchy
|
||||
property color mSurface: customColors.mSurface
|
||||
property color mOnSurface: customColors.mOnSurface
|
||||
property color mSurfaceVariant: customColors.mSurfaceVariant
|
||||
property color mOnSurfaceVariant: customColors.mOnSurfaceVariant
|
||||
property color mOutline: customColors.mOutline
|
||||
property color mOutlineVariant: customColors.mOutlineVariant
|
||||
property color mShadow: customColors.mShadow
|
||||
|
||||
// -----------
|
||||
function applyOpacity(color, opacity) {
|
||||
// Convert color to string and apply opacity
|
||||
return color.toString().replace("#", "#" + opacity)
|
||||
}
|
||||
|
||||
// --------------------------------
|
||||
// Default colors: RosePine
|
||||
QtObject {
|
||||
id: defaultColors
|
||||
|
||||
property color mPrimary: "#ebbcba"
|
||||
property color mOnPrimary: "#1f1d2e"
|
||||
property color mSecondary: "#31748f"
|
||||
property color mOnSecondary: "#e0def4"
|
||||
property color mTertiary: "#9ccfd8"
|
||||
property color mOnTertiary: "#191724"
|
||||
|
||||
property color mError: "#eb6f92"
|
||||
property color mOnError: "#1f1d2e"
|
||||
|
||||
property color mSurface: "#1f1d2e"
|
||||
property color mOnSurface: "#e0def4"
|
||||
property color mSurfaceVariant: "#26233a"
|
||||
property color mOnSurfaceVariant: "#908caa"
|
||||
property color mOutline: "#44415a"
|
||||
property color mOutlineVariant: "#514e6c"
|
||||
property color mShadow: "#191724"
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Custom colors loaded from colors.json
|
||||
// These can be generated by matugen or simply come from a well know color scheme (Dracula, Gruvbox, Nord, ...)
|
||||
QtObject {
|
||||
id: customColors
|
||||
|
||||
property color mPrimary: customColorsData.mPrimary
|
||||
property color mOnPrimary: customColorsData.mOnPrimary
|
||||
property color mSecondary: customColorsData.mSecondary
|
||||
property color mOnSecondary: customColorsData.mOnSecondary
|
||||
property color mTertiary: customColorsData.mTertiary
|
||||
property color mOnTertiary: customColorsData.mOnTertiary
|
||||
|
||||
property color mError: customColorsData.mError
|
||||
property color mOnError: customColorsData.mOnError
|
||||
|
||||
property color mSurface: customColorsData.mSurface
|
||||
property color mOnSurface: customColorsData.mOnSurface
|
||||
property color mSurfaceVariant: customColorsData.mSurfaceVariant
|
||||
property color mOnSurfaceVariant: customColorsData.mOnSurfaceVariant
|
||||
property color mOutline: customColorsData.mOutline
|
||||
property color mOutlineVariant: customColorsData.mOutlineVariant
|
||||
property color mShadow: customColorsData.mShadow
|
||||
}
|
||||
|
||||
// FileView to load custom colors data from colors.json
|
||||
FileView {
|
||||
id: customColorsFile
|
||||
path: Settings.configDir + "colors.json"
|
||||
watchChanges: true
|
||||
onFileChanged: {
|
||||
console.log("[Colors] Reloading colors from disk")
|
||||
reload()
|
||||
}
|
||||
onAdapterUpdated: {
|
||||
console.log("[Colors] Writing colors to disk")
|
||||
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: customColorsData
|
||||
|
||||
property color mPrimary: defaultColors.mPrimary
|
||||
property color mOnPrimary: defaultColors.mOnPrimary
|
||||
property color mSecondary: defaultColors.mSecondary
|
||||
property color mOnSecondary: defaultColors.mOnSecondary
|
||||
property color mTertiary: defaultColors.mTertiary
|
||||
property color mOnTertiary: defaultColors.mOnTertiary
|
||||
|
||||
property color mError: defaultColors.mError
|
||||
property color mOnError: defaultColors.mOnError
|
||||
|
||||
property color mSurface: defaultColors.mSurface
|
||||
property color mOnSurface: defaultColors.mOnSurface
|
||||
property color mSurfaceVariant: defaultColors.mSurfaceVariant
|
||||
property color mOnSurfaceVariant: defaultColors.mOnSurfaceVariant
|
||||
property color mOutline: defaultColors.mOutline
|
||||
property color mOutlineVariant: defaultColors.mOutlineVariant
|
||||
property color mShadow: defaultColors.mShadow
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue