Skip to content

Commit 69580bb

Browse files
authored
Merge pull request #128 from danielsaidi/bugfix/style_colors
Minor UI tweaks
2 parents 3dbad7a + 42f7796 commit 69580bb

9 files changed

+28
-8
lines changed

Demo/iOS/EditorScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private extension EditorScreen {
5959
trailingButtons: {}
6060
) {
6161
var sheet = $0
62-
// sheet.colorPickers = .all
62+
sheet.colorPickers = .all
6363
return sheet
6464
}
6565
}

Sources/RichTextKit/Actions/RichTextAction+Button.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public extension RichTextAction {
1717
use and configure it as a normal button.
1818
*/
1919
struct Button: View {
20-
2120
/**
2221
Create a rich text action button.
2322

Sources/RichTextKit/Alignment/RichTextAlignment+Picker.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public extension RichTextAlignment {
1717
be styled and configured with plain SwiftUI.
1818
*/
1919
struct Picker: View {
20-
2120
/**
2221
Create a rich text alignment picker.
2322

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// Color+SystemSpecificTextColor.swift
3+
//
4+
//
5+
// Created by Dominik Bucher on 22.01.2024.
6+
//
7+
8+
import SwiftUI
9+
10+
extension Color {
11+
#if macOS
12+
// on macOS
13+
static let systemSpecificTextColor: Color? = Color(NSColor.textColor)
14+
#else
15+
static let systemSpecificTextColor: Color? = nil
16+
#endif
17+
}

Sources/RichTextKit/Colors/RichTextColor.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ public extension RichTextColor {
8686
}
8787
}
8888

89-
public extension Collection where Element == RichTextColor {
89+
public extension Collection where Element == RichTextColor {
90+
static var all: [RichTextColor] { Element.allCases - .undefined }
91+
}
9092

91-
static var all: [RichTextColor] { Element.allCases }
93+
extension Array where Element == RichTextColor {
94+
static func - (lhs: [RichTextColor], rhs: RichTextColor) -> [RichTextColor] {
95+
return lhs.filter { $0 != rhs }
96+
}
9297
}

Sources/RichTextKit/Coordinator/RichTextCoordinator+Subscriptions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ internal extension RichTextCoordinator {
360360
}
361361
}
362362

363-
private extension ColorRepresentable {
363+
extension ColorRepresentable {
364364

365365
#if iOS || os(tvOS) || os(visionOS)
366366
static var textColor: ColorRepresentable { .label }

Sources/RichTextKit/Styles/RichTextStyle+Button.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ extension View {
8686
if cond {
8787
self.foregroundStyle(Color.accentColor)
8888
} else {
89-
self
89+
self.foregroundStyle(color)
9090
}
9191
}
9292
}

Sources/RichTextKit/Styles/RichTextStyle+Toggle.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public extension RichTextStyle {
7777
style.icon
7878
.frame(maxHeight: fillVertically ? .infinity : nil)
7979
}
80+
.foreground(Color(ColorRepresentable.textColor), if: isOn)
8081
.keyboardShortcut(for: style)
8182
.accessibilityLabel(style.title)
8283
}

Sources/RichTextKit/_Deprecated/RichTextViewComponent+Deprecated.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ public extension RichTextViewComponent {
135135
setRichTextAttributes(attributes)
136136
}
137137

138-
139138
@available(*, deprecated, message: "richTextAlignment")
140139
var currentTextAlignment: RichTextAlignment? {
141140
richTextAlignment

0 commit comments

Comments
 (0)