Skip to content

Commit

Permalink
Merge pull request #128 from danielsaidi/bugfix/style_colors
Browse files Browse the repository at this point in the history
Minor UI tweaks
  • Loading branch information
danielsaidi authored Jan 23, 2024
2 parents 3dbad7a + 42f7796 commit 69580bb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Demo/iOS/EditorScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private extension EditorScreen {
trailingButtons: {}
) {
var sheet = $0
// sheet.colorPickers = .all
sheet.colorPickers = .all
return sheet
}
}
Expand Down
1 change: 0 additions & 1 deletion Sources/RichTextKit/Actions/RichTextAction+Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public extension RichTextAction {
use and configure it as a normal button.
*/
struct Button: View {

/**
Create a rich text action button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public extension RichTextAlignment {
be styled and configured with plain SwiftUI.
*/
struct Picker: View {

/**
Create a rich text alignment picker.
Expand Down
17 changes: 17 additions & 0 deletions Sources/RichTextKit/Colors/Color+SystemSpecificTextColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Color+SystemSpecificTextColor.swift
//
//
// Created by Dominik Bucher on 22.01.2024.
//

import SwiftUI

extension Color {
#if macOS
// on macOS
static let systemSpecificTextColor: Color? = Color(NSColor.textColor)
#else
static let systemSpecificTextColor: Color? = nil
#endif
}
9 changes: 7 additions & 2 deletions Sources/RichTextKit/Colors/RichTextColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ public extension RichTextColor {
}
}

public extension Collection where Element == RichTextColor {
public extension Collection where Element == RichTextColor {
static var all: [RichTextColor] { Element.allCases - .undefined }
}

static var all: [RichTextColor] { Element.allCases }
extension Array where Element == RichTextColor {
static func - (lhs: [RichTextColor], rhs: RichTextColor) -> [RichTextColor] {
return lhs.filter { $0 != rhs }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ internal extension RichTextCoordinator {
}
}

private extension ColorRepresentable {
extension ColorRepresentable {

#if iOS || os(tvOS) || os(visionOS)
static var textColor: ColorRepresentable { .label }
Expand Down
2 changes: 1 addition & 1 deletion Sources/RichTextKit/Styles/RichTextStyle+Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension View {
if cond {
self.foregroundStyle(Color.accentColor)
} else {
self
self.foregroundStyle(color)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/RichTextKit/Styles/RichTextStyle+Toggle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public extension RichTextStyle {
style.icon
.frame(maxHeight: fillVertically ? .infinity : nil)
}
.foreground(Color(ColorRepresentable.textColor), if: isOn)
.keyboardShortcut(for: style)
.accessibilityLabel(style.title)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public extension RichTextViewComponent {
setRichTextAttributes(attributes)
}


@available(*, deprecated, message: "richTextAlignment")
var currentTextAlignment: RichTextAlignment? {
richTextAlignment
Expand Down

0 comments on commit 69580bb

Please sign in to comment.