mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-02 02:26:00 +00:00
Color and Style: readonly everywhere and simplification, reducing the number of bindings.
This commit is contained in:
+37
-66
@@ -20,96 +20,66 @@ 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
|
||||
readonly property color mPrimary: customColorsData.mPrimary
|
||||
readonly property color mOnPrimary: customColorsData.mOnPrimary
|
||||
readonly property color mSecondary: customColorsData.mSecondary
|
||||
readonly property color mOnSecondary: customColorsData.mOnSecondary
|
||||
readonly property color mTertiary: customColorsData.mTertiary
|
||||
readonly property color mOnTertiary: customColorsData.mOnTertiary
|
||||
|
||||
// --- Utility Colors: These colors serve specific, universal purposes like indicating errors
|
||||
property color mError: customColors.mError
|
||||
property color mOnError: customColors.mOnError
|
||||
readonly property color mError: customColorsData.mError
|
||||
readonly property color mOnError: customColorsData.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
|
||||
readonly property color mSurface: customColorsData.mSurface
|
||||
readonly property color mOnSurface: customColorsData.mOnSurface
|
||||
|
||||
property color mSurfaceVariant: customColors.mSurfaceVariant
|
||||
property color mOnSurfaceVariant: customColors.mOnSurfaceVariant
|
||||
readonly property color mSurfaceVariant: customColorsData.mSurfaceVariant
|
||||
readonly property color mOnSurfaceVariant: customColorsData.mOnSurfaceVariant
|
||||
|
||||
property color mOutline: customColors.mOutline
|
||||
property color mShadow: customColors.mShadow
|
||||
readonly property color mOutline: customColorsData.mOutline
|
||||
readonly property color mShadow: customColorsData.mShadow
|
||||
|
||||
property color mHover: customColors.mHover
|
||||
property color mOnHover: customColors.mOnHover
|
||||
readonly property color mHover: customColorsData.mHover
|
||||
readonly property color mOnHover: customColorsData.mOnHover
|
||||
|
||||
// --- Absolute Colors
|
||||
property color transparent: "transparent"
|
||||
property color black: "#000000"
|
||||
property color white: "#ffffff"
|
||||
readonly property color transparent: "transparent"
|
||||
readonly property color black: "#000000"
|
||||
readonly property color white: "#ffffff"
|
||||
|
||||
// --------------------------------
|
||||
// Default colors: RosePine
|
||||
QtObject {
|
||||
id: defaultColors
|
||||
|
||||
property color mPrimary: "#c7a1d8"
|
||||
property color mOnPrimary: "#1a151f"
|
||||
readonly property color mPrimary: "#c7a1d8"
|
||||
readonly property color mOnPrimary: "#1a151f"
|
||||
|
||||
property color mSecondary: "#a984c4"
|
||||
property color mOnSecondary: "#f3edf7"
|
||||
readonly property color mSecondary: "#a984c4"
|
||||
readonly property color mOnSecondary: "#f3edf7"
|
||||
|
||||
property color mTertiary: "#e0b7c9"
|
||||
property color mOnTertiary: "#20161f"
|
||||
readonly property color mTertiary: "#e0b7c9"
|
||||
readonly property color mOnTertiary: "#20161f"
|
||||
|
||||
property color mError: "#e9899d"
|
||||
property color mOnError: "#1e1418"
|
||||
readonly property color mError: "#e9899d"
|
||||
readonly property color mOnError: "#1e1418"
|
||||
|
||||
property color mSurface: "#1c1822"
|
||||
property color mOnSurface: "#e9e4f0"
|
||||
readonly property color mSurface: "#1c1822"
|
||||
readonly property color mOnSurface: "#e9e4f0"
|
||||
|
||||
property color mSurfaceVariant: "#262130"
|
||||
property color mOnSurfaceVariant: "#a79ab0"
|
||||
readonly property color mSurfaceVariant: "#262130"
|
||||
readonly property color mOnSurfaceVariant: "#a79ab0"
|
||||
|
||||
property color mOutline: "#342c42"
|
||||
property color mShadow: "#120f18"
|
||||
readonly property color mOutline: "#342c42"
|
||||
readonly property color mShadow: "#120f18"
|
||||
|
||||
property color mHover: "#e0b7c9"
|
||||
property color mOnHover: "#20161f"
|
||||
readonly property color mHover: "#e0b7c9"
|
||||
readonly property color mOnHover: "#20161f"
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// 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 mShadow: customColorsData.mShadow
|
||||
|
||||
property color mHover: customColorsData.mHover
|
||||
property color mOnHover: customColorsData.mOnHover
|
||||
}
|
||||
|
||||
// FileView to load custom colors data from colors.json
|
||||
FileView {
|
||||
id: customColorsFile
|
||||
@@ -132,7 +102,8 @@ Singleton {
|
||||
}
|
||||
}
|
||||
onLoadFailed: function (error) {
|
||||
if (error.toString().includes("No such file") || error === 2) {
|
||||
// Error code 2 = ENOENT (No such file or directory)
|
||||
if (error === 2 || error.toString().includes("No such file")) {
|
||||
// File doesn't exist, create it with default values
|
||||
writeAdapter()
|
||||
}
|
||||
|
||||
+51
-51
@@ -13,77 +13,77 @@ Singleton {
|
||||
*/
|
||||
|
||||
// Font size
|
||||
property real fontSizeXXS: 8
|
||||
property real fontSizeXS: 9
|
||||
property real fontSizeS: 10
|
||||
property real fontSizeM: 11
|
||||
property real fontSizeL: 13
|
||||
property real fontSizeXL: 16
|
||||
property real fontSizeXXL: 18
|
||||
property real fontSizeXXXL: 24
|
||||
readonly property real fontSizeXXS: 8
|
||||
readonly property real fontSizeXS: 9
|
||||
readonly property real fontSizeS: 10
|
||||
readonly property real fontSizeM: 11
|
||||
readonly property real fontSizeL: 13
|
||||
readonly property real fontSizeXL: 16
|
||||
readonly property real fontSizeXXL: 18
|
||||
readonly property real fontSizeXXXL: 24
|
||||
|
||||
// Font weight
|
||||
property int fontWeightRegular: 400
|
||||
property int fontWeightMedium: 500
|
||||
property int fontWeightSemiBold: 600
|
||||
property int fontWeightBold: 700
|
||||
readonly property int fontWeightRegular: 400
|
||||
readonly property int fontWeightMedium: 500
|
||||
readonly property int fontWeightSemiBold: 600
|
||||
readonly property int fontWeightBold: 700
|
||||
|
||||
// Radii
|
||||
property int radiusXXS: Math.round(4 * Settings.data.general.radiusRatio)
|
||||
property int radiusXS: Math.round(8 * Settings.data.general.radiusRatio)
|
||||
property int radiusS: Math.round(12 * Settings.data.general.radiusRatio)
|
||||
property int radiusM: Math.round(16 * Settings.data.general.radiusRatio)
|
||||
property int radiusL: Math.round(20 * Settings.data.general.radiusRatio)
|
||||
property int screenRadius: Math.round(20 * Settings.data.general.screenRadiusRatio)
|
||||
readonly property int radiusXXS: Math.round(4 * Settings.data.general.radiusRatio)
|
||||
readonly property int radiusXS: Math.round(8 * Settings.data.general.radiusRatio)
|
||||
readonly property int radiusS: Math.round(12 * Settings.data.general.radiusRatio)
|
||||
readonly property int radiusM: Math.round(16 * Settings.data.general.radiusRatio)
|
||||
readonly property int radiusL: Math.round(20 * Settings.data.general.radiusRatio)
|
||||
readonly property int screenRadius: Math.round(20 * Settings.data.general.screenRadiusRatio)
|
||||
|
||||
// Border
|
||||
property int borderS: Math.max(1, Math.round(1 * uiScaleRatio))
|
||||
property int borderM: Math.max(1, Math.round(2 * uiScaleRatio))
|
||||
property int borderL: Math.max(1, Math.round(3 * uiScaleRatio))
|
||||
readonly property int borderS: Math.max(1, Math.round(1 * uiScaleRatio))
|
||||
readonly property int borderM: Math.max(1, Math.round(2 * uiScaleRatio))
|
||||
readonly property int borderL: Math.max(1, Math.round(3 * uiScaleRatio))
|
||||
|
||||
// Margins (for margins and spacing)
|
||||
property int marginXXS: Math.round(2 * uiScaleRatio)
|
||||
property int marginXS: Math.round(4 * uiScaleRatio)
|
||||
property int marginS: Math.round(6 * uiScaleRatio)
|
||||
property int marginM: Math.round(9 * uiScaleRatio)
|
||||
property int marginL: Math.round(13 * uiScaleRatio)
|
||||
property int marginXL: Math.round(18 * uiScaleRatio)
|
||||
readonly property int marginXXS: Math.round(2 * uiScaleRatio)
|
||||
readonly property int marginXS: Math.round(4 * uiScaleRatio)
|
||||
readonly property int marginS: Math.round(6 * uiScaleRatio)
|
||||
readonly property int marginM: Math.round(9 * uiScaleRatio)
|
||||
readonly property int marginL: Math.round(13 * uiScaleRatio)
|
||||
readonly property int marginXL: Math.round(18 * uiScaleRatio)
|
||||
|
||||
// Opacity
|
||||
property real opacityNone: 0.0
|
||||
property real opacityLight: 0.25
|
||||
property real opacityMedium: 0.5
|
||||
property real opacityHeavy: 0.75
|
||||
property real opacityAlmost: 0.95
|
||||
property real opacityFull: 1.0
|
||||
readonly property real opacityNone: 0.0
|
||||
readonly property real opacityLight: 0.25
|
||||
readonly property real opacityMedium: 0.5
|
||||
readonly property real opacityHeavy: 0.75
|
||||
readonly property real opacityAlmost: 0.95
|
||||
readonly property real opacityFull: 1.0
|
||||
|
||||
// Shadows
|
||||
property real shadowOpacity: 0.85
|
||||
property real shadowBlur: 1.0
|
||||
property int shadowBlurMax: 22
|
||||
property real shadowHorizontalOffset: Settings.data.general.shadowOffsetX
|
||||
property real shadowVerticalOffset: Settings.data.general.shadowOffsetY
|
||||
readonly property real shadowOpacity: 0.85
|
||||
readonly property real shadowBlur: 1.0
|
||||
readonly property int shadowBlurMax: 22
|
||||
readonly property real shadowHorizontalOffset: Settings.data.general.shadowOffsetX
|
||||
readonly property real shadowVerticalOffset: Settings.data.general.shadowOffsetY
|
||||
|
||||
// Animation duration (ms)
|
||||
property int animationFaster: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(75 / Settings.data.general.animationSpeed)
|
||||
property int animationFast: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(150 / Settings.data.general.animationSpeed)
|
||||
property int animationNormal: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(300 / Settings.data.general.animationSpeed)
|
||||
property int animationSlow: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(450 / Settings.data.general.animationSpeed)
|
||||
property int animationSlowest: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(750 / Settings.data.general.animationSpeed)
|
||||
readonly property int animationFaster: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(75 / Settings.data.general.animationSpeed)
|
||||
readonly property int animationFast: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(150 / Settings.data.general.animationSpeed)
|
||||
readonly property int animationNormal: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(300 / Settings.data.general.animationSpeed)
|
||||
readonly property int animationSlow: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(450 / Settings.data.general.animationSpeed)
|
||||
readonly property int animationSlowest: (Settings.data.general.animationDisabled || PowerProfileService.noctaliaPerformanceMode) ? 0 : Math.round(750 / Settings.data.general.animationSpeed)
|
||||
|
||||
// Delays
|
||||
property int tooltipDelay: 300
|
||||
property int tooltipDelayLong: 1200
|
||||
property int pillDelay: 500
|
||||
readonly property int tooltipDelay: 300
|
||||
readonly property int tooltipDelayLong: 1200
|
||||
readonly property int pillDelay: 500
|
||||
|
||||
// Widgets base size
|
||||
property real baseWidgetSize: 33
|
||||
property real sliderWidth: 200
|
||||
readonly property real baseWidgetSize: 33
|
||||
readonly property real sliderWidth: 200
|
||||
|
||||
property real uiScaleRatio: Settings.data.general.scaleRatio
|
||||
readonly property real uiScaleRatio: Settings.data.general.scaleRatio
|
||||
|
||||
// Bar Dimensions
|
||||
property real barHeight: {
|
||||
readonly property real barHeight: {
|
||||
switch (Settings.data.bar.density) {
|
||||
case "mini":
|
||||
return (Settings.data.bar.position === "left" || Settings.data.bar.position === "right") ? 22 : 20
|
||||
@@ -97,7 +97,7 @@ Singleton {
|
||||
return (Settings.data.bar.position === "left" || Settings.data.bar.position === "right") ? 33 : 31
|
||||
}
|
||||
}
|
||||
property real capsuleHeight: {
|
||||
readonly property real capsuleHeight: {
|
||||
switch (Settings.data.bar.density) {
|
||||
case "mini":
|
||||
return Math.round(barHeight * 1.0)
|
||||
|
||||
Reference in New Issue
Block a user