File tree Expand file tree Collapse file tree 4 files changed +20
-15
lines changed Expand file tree Collapse file tree 4 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,20 @@ This release starts moving types and views that relate to other types into the t
14
14
15
15
* ` RichTextAlignment.Picker ` has a new style parameter.
16
16
* ` RichTextCommand ` is a new namespace for command-related views.
17
+ * ` RichTextColorPicker ` now shows a quick button to reset the color.
17
18
* ` RichTextLabelValue ` is a new protocol to harmonize label-compatible label values.
18
19
19
20
### 💡 Adjustments
20
21
21
22
* Many value types implement ` RichTextLabelValue ` to get a ` label ` property.
22
23
* All types that implement ` RichTextLabelValue ` get a ` label ` that has improved accessibility.
23
24
25
+ * ` RichTextColor ` ` .adjust ` now takes an optional
26
+
24
27
### 🐛 Bug Fixes
25
28
26
- * ` Image.symbol(...) ` removes ` palette ` rendering mode.
29
+ * ` Image.symbol(...) ` removes ` palette ` rendering mode to fix incorrect color scheme behavior.
30
+ * ` RichTextColorPicker ` no longer auto-adjusts black and white to make it possible to actually set those colors.
27
31
28
32
### 🗑️ Deprecations
29
33
Original file line number Diff line number Diff line change @@ -59,7 +59,11 @@ public extension RichTextColor {
59
59
iconView
60
60
picker
61
61
if hasColors {
62
- quickPickerDivider
62
+ HStack ( spacing: spacing) {
63
+ quickPickerDivider
64
+ quickPickerButton ( for: nil )
65
+ quickPickerDivider
66
+ }
63
67
quickPicker
64
68
}
65
69
}
@@ -126,11 +130,15 @@ private extension RichTextColor.Picker {
126
130
} . frame ( maxWidth: . infinity)
127
131
}
128
132
129
- func quickPickerButton( for color: Color ) -> some View {
133
+ func quickPickerButton( for color: Color ? ) -> some View {
130
134
Button {
131
135
value = type. adjust ( color, for: colorScheme)
132
136
} label: {
133
- color
137
+ if let color {
138
+ color
139
+ } else {
140
+ Image . richTextColorReset
141
+ }
134
142
}
135
143
. buttonStyle ( ColorButtonStyle ( ) )
136
144
}
Original file line number Diff line number Diff line change @@ -65,20 +65,12 @@ public extension RichTextColor {
65
65
66
66
/// Adjust a `color` for a certain `colorScheme`.
67
67
func adjust(
68
- _ color: Color ,
68
+ _ color: Color ? ,
69
69
for scheme: ColorScheme
70
70
) -> Color {
71
71
switch self {
72
- case . background:
73
- if ( color == . black && scheme == . dark) || ( color == . white && scheme == . light) {
74
- return . clear
75
- }
76
- return color
77
- default :
78
- if ( color == . white && scheme == . dark) || ( color == . black && scheme == . light) {
79
- return . primary
80
- }
81
- return color
72
+ case . background: return color ?? . clear
73
+ default : return color ?? . primary
82
74
}
83
75
}
84
76
}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public extension Image {
26
26
27
27
static let richTextColorBackground = symbol ( " highlighter " )
28
28
static let richTextColorForeground = symbol ( " character " )
29
+ static let richTextColorReset = symbol ( " circle.slash " )
29
30
static let richTextColorStroke = symbol ( " a.square " )
30
31
static let richTextColorStrikethrough = symbol ( " strikethrough " )
31
32
static let richTextColorUnderline = symbol ( " underline " )
You can’t perform that action at this time.
0 commit comments