Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Sources/SwiftTerm/Apple/AppleTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,9 @@ extension TerminalView {
if isSelected {
var mutable = attributes
mutable[.selectionBackgroundColor] = selectedTextBackgroundColor
if let selectedTextForegroundColor {
mutable[.foregroundColor] = selectedTextForegroundColor
}
currentAttributes = mutable
} else {
currentAttributes = attributes
Expand Down
13 changes: 13 additions & 0 deletions Sources/SwiftTerm/Mac/MacTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations,
}
}

var _selectedTextForegroundColor: NSColor? = nil
/// The color used to render the text of the selection. When `nil` (the default),
/// selected text keeps its original foreground color and only the selection
/// background is drawn.
public var selectedTextForegroundColor: NSColor? {
get {
return _selectedTextForegroundColor
}
set {
_selectedTextForegroundColor = newValue
}
}

func backingScaleFactor () -> CGFloat
{
window?.backingScaleFactor ?? NSScreen.main?.backingScaleFactor ?? 1
Expand Down
13 changes: 13 additions & 0 deletions Sources/SwiftTerm/iOS/iOSTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1258,6 +1258,19 @@ open class TerminalView: UIScrollView, UITextInputTraits, UIKeyInput, UIScrollVi
_selectedTextBackgroundColor = newValue
}
}

var _selectedTextForegroundColor: UIColor? = nil
/// The color used to render the text of the selection. When `nil` (the default),
/// selected text keeps its original foreground color and only the selection
/// background is drawn.
public var selectedTextForegroundColor: UIColor? {
get {
return _selectedTextForegroundColor
}
set {
_selectedTextForegroundColor = newValue
}
}

var _selectionHandleColor: UIColor = UIColor.systemBlue
/// The color used to render the selection handles
Expand Down