mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-08 04:20:07 +02:00
👌 Use specific theme colors for services status
This commit is contained in:
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.501",
|
||||||
|
"green" : "0.697",
|
||||||
|
"red" : "0.247"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.501",
|
||||||
|
"green" : "0.765",
|
||||||
|
"red" : "0.247"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
38
phpmon/Assets.xcassets/StatusColorRed.colorset/Contents.json
Normal file
38
phpmon/Assets.xcassets/StatusColorRed.colorset/Contents.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.180",
|
||||||
|
"green" : "0.000",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.426",
|
||||||
|
"green" : "0.363",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"colors" : [
|
||||||
|
{
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.180",
|
||||||
|
"green" : "0.841",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appearances" : [
|
||||||
|
{
|
||||||
|
"appearance" : "luminosity",
|
||||||
|
"value" : "dark"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"color" : {
|
||||||
|
"color-space" : "srgb",
|
||||||
|
"components" : {
|
||||||
|
"alpha" : "1.000",
|
||||||
|
"blue" : "0.426",
|
||||||
|
"green" : "0.809",
|
||||||
|
"red" : "1.000"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
@ -66,7 +66,7 @@ class ServicesManager: ObservableObject {
|
|||||||
|
|
||||||
public var statusColor: Color {
|
public var statusColor: Color {
|
||||||
if self.services.isEmpty || !self.firstRunComplete {
|
if self.services.isEmpty || !self.firstRunComplete {
|
||||||
return .yellow
|
return Color("StatusColorYellow")
|
||||||
}
|
}
|
||||||
|
|
||||||
let statuses = self.services[0...2].map { $0.status }
|
let statuses = self.services[0...2].map { $0.status }
|
||||||
@ -74,10 +74,10 @@ class ServicesManager: ObservableObject {
|
|||||||
if statuses.contains(.missing)
|
if statuses.contains(.missing)
|
||||||
|| statuses.contains(.inactive)
|
|| statuses.contains(.inactive)
|
||||||
|| statuses.contains(.error) {
|
|| statuses.contains(.error) {
|
||||||
return .red
|
return Color("StatusColorRed")
|
||||||
}
|
}
|
||||||
|
|
||||||
return .green
|
return Color("StatusColorGreen")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +143,7 @@ struct ServiceView: View {
|
|||||||
} label: {
|
} label: {
|
||||||
Text("E")
|
Text("E")
|
||||||
.frame(width: 12.0, height: 12.0)
|
.frame(width: 12.0, height: 12.0)
|
||||||
.foregroundColor(Color("IconColorRed"))
|
.foregroundColor(Color("StatusColorRed"))
|
||||||
}
|
}
|
||||||
.focusable(false)
|
.focusable(false)
|
||||||
.frame(width: 25, height: 25)
|
.frame(width: 25, height: 25)
|
||||||
@ -163,8 +163,8 @@ struct ServiceView: View {
|
|||||||
.frame(width: 12.0, height: 12.0)
|
.frame(width: 12.0, height: 12.0)
|
||||||
.foregroundColor(
|
.foregroundColor(
|
||||||
service.status == .active
|
service.status == .active
|
||||||
? Color("IconColorGreen")
|
? Color("StatusColorGreen")
|
||||||
: Color("IconColorRed")
|
: Color("StatusColorRed")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.focusable(false)
|
.focusable(false)
|
||||||
|
Reference in New Issue
Block a user