@@ -33,7 +33,7 @@ public class CompoundColors {
33
33
private var overrides = [ KeyPath < CompoundColorTokens , Color > : Color ] ( )
34
34
35
35
public subscript( dynamicMember keyPath: KeyPath < CompoundColorTokens , Color > ) -> Color {
36
- return overrides [ keyPath] ?? tokens [ keyPath: keyPath]
36
+ overrides [ keyPath] ?? tokens [ keyPath: keyPath]
37
37
}
38
38
39
39
/// Customise the colour at the specified key path with the supplied colour.
@@ -47,16 +47,17 @@ public class CompoundColors {
47
47
self . tokens = tokens
48
48
49
49
decorativeColors = [
50
- . init( background: tokens. bgDecorative1, text: tokens. textDecorative1) ,
51
- . init( background: tokens. bgDecorative2, text: tokens. textDecorative2) ,
52
- . init( background: tokens. bgDecorative3, text: tokens. textDecorative3) ,
53
- . init( background: tokens. bgDecorative4, text: tokens. textDecorative4) ,
54
- . init( background: tokens. bgDecorative5, text: tokens. textDecorative5) ,
55
- . init( background: tokens. bgDecorative6, text: tokens. textDecorative6) ,
56
- ]
50
+ . init( background: tokens. bgDecorative1, text: tokens. textDecorative1) ,
51
+ . init( background: tokens. bgDecorative2, text: tokens. textDecorative2) ,
52
+ . init( background: tokens. bgDecorative3, text: tokens. textDecorative3) ,
53
+ . init( background: tokens. bgDecorative4, text: tokens. textDecorative4) ,
54
+ . init( background: tokens. bgDecorative5, text: tokens. textDecorative5) ,
55
+ . init( background: tokens. bgDecorative6, text: tokens. textDecorative6)
56
+ ]
57
57
}
58
58
59
59
// MARK: - Decorative Colors
60
+
60
61
// Used to determine the background and text colors of avatars, usernames etc.
61
62
62
63
let decorativeColors : [ DecorativeColor ]
@@ -67,6 +68,7 @@ public class CompoundColors {
67
68
68
69
// MARK: - Awaiting Semantic Tokens
69
70
71
+ // swiftformat:disable numberFormatting
70
72
/// This token is a placeholder and hasn't been finalised.
71
73
@available ( iOS, deprecated: 100000.0 , message: " This token should be generated by now. " )
72
74
public let _borderTextFieldFocused = coreTokens. gray500
@@ -91,6 +93,7 @@ public class CompoundColors {
91
93
/// This token is a placeholder and hasn't been finalised.
92
94
@available ( iOS, deprecated: 100000.0 , message: " This token should be generated by now. " )
93
95
public let _bgEmptyItemAlpha = coreTokens. alphaGray500
96
+ // swiftformat:enable numberFormatting
94
97
}
95
98
96
99
private extension UITraitCollection {
@@ -107,9 +110,9 @@ private extension String {
107
110
/// Calculates a numeric hash same as Element Web
108
111
/// See original function here https://github.com/matrix-org/matrix-react-sdk/blob/321dd49db4fbe360fc2ff109ac117305c955b061/src/utils/FormattingUtils.js#L47
109
112
var hashCode : Int {
110
- let characterCodeSum = self . reduce ( 0 ) { sum, character in
113
+ let characterCodeSum = reduce ( 0 ) { sum, character in
111
114
sum + Int( character. unicodeScalars. first? . value ?? 0 )
112
115
}
113
- return ( characterCodeSum % Color. compound. decorativeColors. count)
116
+ return characterCodeSum % Color. compound. decorativeColors. count
114
117
}
115
118
}
0 commit comments