Skip to content

Commit 797d7ff

Browse files
Finally FIX system-specific buttons
1 parent cf79c4e commit 797d7ff

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Sources/RichTextKit/Component/RichTextViewComponent+Attributes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public extension RichTextViewComponent {
1919
#if macOS
2020
let range = NSRange(location: selectedRange.location - 1, length: 1)
2121
let safeRange = safeRange(for: range)
22-
return richTextAttributes(at: safeRange)
22+
return richTextAttributes(at: safeRange )
2323
#else
2424
return typingAttributes
2525
#endif

Sources/RichTextKit/Styles/RichTextStyleButton.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,23 @@ public extension RichTextStyleButton {
9191
*/
9292
struct Style {
9393

94+
#if macOS
95+
private let systemSpecificTextColor: Color? = Color(NSColor.textColor)
96+
#else
97+
private let systemSpecificTextColor: Color? = nil
98+
#endif
9499
/**
95100
Create a rich text style button style.
96-
101+
97102
- Parameters:
98-
- inactiveColor: The color to apply when the button is inactive, by default `.primary`.
99-
- activeColor: The color to apply when the button is active, by default `.blue`.
103+
- inactiveColor: The color to apply when the button is inactive, by default `.primary`.
104+
- activeColor: The color to apply when the button is active, by default `.blue`.
100105
*/
101106
public init(
102107
inactiveColor: Color? = nil,
103108
activeColor: Color = .blue
104109
) {
105-
self.inactiveColor = inactiveColor
110+
self.inactiveColor = inactiveColor ?? systemSpecificTextColor
106111
self.activeColor = activeColor
107112
}
108113

0 commit comments

Comments
 (0)