@@ -24,7 +24,12 @@ extension SystemColor {
24
24
/// Extract dark mode color
25
25
public var dark : SystemColor {
26
26
#if canImport(UIKit)
27
+ #if os(watchOS)
28
+ // Since watchOS does not have dark/lightmode we just return the color.
29
+ self
30
+ #else
27
31
resolvedColor ( with: . init( userInterfaceStyle: . dark) )
32
+ #endif
28
33
#else
29
34
var value : SystemColor ?
30
35
@@ -45,7 +50,12 @@ extension SystemColor {
45
50
/// Extract light mode color
46
51
public var light : SystemColor {
47
52
#if canImport(UIKit)
53
+ #if os(watchOS)
54
+ // Since watchOS does not have dark/lightmode we just return the color.
55
+ self
56
+ #else
48
57
resolvedColor ( with: . init( userInterfaceStyle: . light) )
58
+ #endif
49
59
#else
50
60
var value : SystemColor ?
51
61
@@ -82,33 +92,24 @@ extension SystemColor {
82
92
)
83
93
}
84
94
85
- /// Get the CI Color of the current color
86
- var getCIcolor : CIColor {
87
- #if canImport(UIKit)
88
- return CIColor ( color: self )
89
- #elseif canImport(AppKit)
90
- return CIColor ( color: self ) ! // swiftlint:disable:this force_unwrapping
91
- #endif
92
- }
93
-
94
95
/// Get the red value component of the color
95
96
public var redValue : CGFloat {
96
- return getCIcolor . red
97
+ return self . cgColor . components ? [ 0 ] ?? 0
97
98
}
98
99
99
100
/// Get the green value component of the color
100
101
public var greenValue : CGFloat {
101
- return getCIcolor . green
102
+ return self . cgColor . components ? [ 1 ] ?? 0
102
103
}
103
104
104
105
/// Get the blue value component of the color
105
106
public var blueValue : CGFloat {
106
- return getCIcolor . blue
107
+ return self . cgColor . components ? [ 2 ] ?? 0
107
108
}
108
109
109
110
/// Get the alpha value component of the color
110
111
public var alphaValue : CGFloat {
111
- return getCIcolor . alpha
112
+ return self . cgColor . components ? [ 3 ] ?? 0
112
113
}
113
114
114
115
/// Create initializer for (BaseColors.swift)
0 commit comments