diff --git a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift index 651871aee..d73cf0898 100644 --- a/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Evergreen/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -7,7 +7,7 @@ // import Foundation -import RSTextDrawing +import RSCore class TimelineTableCellView: NSTableCellView { @@ -161,16 +161,14 @@ private extension TimelineTableCellView { func updateTextFieldColors() { + updateTitleView() + if isEmphasized && isSelected { textFields.forEach { $0.textColor = NSColor.white } } else { feedNameView.textColor = cellAppearance.feedNameColor dateView.textColor = cellAppearance.dateColor - - if let attributedTitle = cellData?.attributedTitle { - titleView.attributedStringValue = attributedTitle - } } } @@ -222,7 +220,17 @@ private extension TimelineTableCellView { func updateTitleView() { - titleView.attributedStringValue = cellData.attributedTitle + if isEmphasized && isSelected { + if let attributedTitle = cellData?.attributedTitle { + titleView.attributedStringValue = attributedTitle.rs_attributedStringByMakingTextWhite() + } + } + else { + if let attributedTitle = cellData?.attributedTitle { + titleView.attributedStringValue = attributedTitle + } + } + needsLayout = true } diff --git a/Frameworks/RSCore/RSCore.xcodeproj/project.pbxproj b/Frameworks/RSCore/RSCore.xcodeproj/project.pbxproj index e408ccf8d..47ab88ed2 100755 --- a/Frameworks/RSCore/RSCore.xcodeproj/project.pbxproj +++ b/Frameworks/RSCore/RSCore.xcodeproj/project.pbxproj @@ -161,6 +161,8 @@ 84CFF56D1AC3D20A00CEA6C8 /* NSImage+RSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 84CFF56B1AC3D20A00CEA6C8 /* NSImage+RSCore.h */; settings = {ATTRIBUTES = (Public, ); }; }; 84CFF56E1AC3D20A00CEA6C8 /* NSImage+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 84CFF56C1AC3D20A00CEA6C8 /* NSImage+RSCore.m */; }; 84D5BA1E201E87E2009092BD /* URLPasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D5BA1D201E87E2009092BD /* URLPasteboardWriter.swift */; }; + 84E185C6203BEA7900F69BFA /* NSAttributedString+RSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 84E185C4203BEA7900F69BFA /* NSAttributedString+RSCore.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 84E185C7203BEA7900F69BFA /* NSAttributedString+RSCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E185C5203BEA7900F69BFA /* NSAttributedString+RSCore.m */; }; 84E34DA61F9FA1070077082F /* UndoableCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E34DA51F9FA1070077082F /* UndoableCommand.swift */; }; 84E8E0D9202EC39800562D8F /* NSMenu+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E8E0D8202EC39800562D8F /* NSMenu+Extensions.swift */; }; 84F20F831F16BA6200D8E682 /* PropertyList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F20F821F16BA6200D8E682 /* PropertyList.swift */; }; @@ -285,6 +287,8 @@ 84CFF56B1AC3D20A00CEA6C8 /* NSImage+RSCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSImage+RSCore.h"; sourceTree = ""; }; 84CFF56C1AC3D20A00CEA6C8 /* NSImage+RSCore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSImage+RSCore.m"; sourceTree = ""; }; 84D5BA1D201E87E2009092BD /* URLPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = URLPasteboardWriter.swift; path = AppKit/URLPasteboardWriter.swift; sourceTree = ""; }; + 84E185C4203BEA7900F69BFA /* NSAttributedString+RSCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "NSAttributedString+RSCore.h"; path = "AppKit/NSAttributedString+RSCore.h"; sourceTree = ""; }; + 84E185C5203BEA7900F69BFA /* NSAttributedString+RSCore.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = "NSAttributedString+RSCore.m"; path = "AppKit/NSAttributedString+RSCore.m"; sourceTree = ""; }; 84E34DA51F9FA1070077082F /* UndoableCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = UndoableCommand.swift; path = RSCore/UndoableCommand.swift; sourceTree = ""; }; 84E8E0D8202EC39800562D8F /* NSMenu+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "NSMenu+Extensions.swift"; path = "AppKit/NSMenu+Extensions.swift"; sourceTree = ""; }; 84F20F821F16BA6200D8E682 /* PropertyList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PropertyList.swift; sourceTree = ""; }; @@ -460,6 +464,8 @@ 84CFF5511AC3CF4700CEA6C8 /* NSColor+RSCore.h */, 84C6329E200D30F1007BEEAA /* NSAppleEventDescriptor+RSCore.h */, 84C6329F200D30F1007BEEAA /* NSAppleEventDescriptor+RSCore.m */, + 84E185C4203BEA7900F69BFA /* NSAttributedString+RSCore.h */, + 84E185C5203BEA7900F69BFA /* NSAttributedString+RSCore.m */, 84C632A2200D356E007BEEAA /* SendToBlogEditorApp.h */, 84C632A3200D356E007BEEAA /* SendToBlogEditorApp.m */, 84CFF5521AC3CF4700CEA6C8 /* NSColor+RSCore.m */, @@ -579,6 +585,7 @@ 84CFF5271AC3C9A200CEA6C8 /* NSArray+RSCore.h in Headers */, 84CFF5531AC3CF4700CEA6C8 /* NSColor+RSCore.h in Headers */, 84CFF4FA1AC3C69700CEA6C8 /* RSCore.h in Headers */, + 84E185C6203BEA7900F69BFA /* NSAttributedString+RSCore.h in Headers */, 844F91D51D90D86100820C48 /* RSTransparentContainerView.h in Headers */, 84CFF53F1AC3CD0100CEA6C8 /* NSMutableSet+RSCore.h in Headers */, 84C632A0200D30F1007BEEAA /* NSAppleEventDescriptor+RSCore.h in Headers */, @@ -791,6 +798,7 @@ 84CFF53C1AC3CCCA00CEA6C8 /* NSMutableDictionary+RSCore.m in Sources */, 8414CBAC1C95F8F700333C12 /* RSGeometry.m in Sources */, 84134D201C59D5450063FD24 /* NSCalendar+RSCore.m in Sources */, + 84E185C7203BEA7900F69BFA /* NSAttributedString+RSCore.m in Sources */, 84CFF5651AC3D13C00CEA6C8 /* RSImageRenderer.m in Sources */, 849EE70D2039187D0082A1EA /* NSWindowController+RSCore.swift in Sources */, 84CFF5381AC3CBB200CEA6C8 /* NSMutableArray+RSCore.m in Sources */, diff --git a/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.h b/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.h new file mode 100644 index 000000000..e6202fc55 --- /dev/null +++ b/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.h @@ -0,0 +1,17 @@ +// +// NSAttributedString.h +// RSCore +// +// Created by Brent Simmons on 2/19/18. +// Copyright © 2018 Ranchero Software, LLC. All rights reserved. +// + +@import AppKit; + +@interface NSAttributedString (RSCore) + +// Useful for table/outline views when a row is selected. + +- (NSAttributedString *)rs_attributedStringByMakingTextWhite; + +@end diff --git a/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.m b/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.m new file mode 100644 index 000000000..5d17f1b52 --- /dev/null +++ b/Frameworks/RSCore/RSCore/AppKit/NSAttributedString+RSCore.m @@ -0,0 +1,20 @@ +// +// NSAttributedString.m +// RSCore +// +// Created by Brent Simmons on 2/19/18. +// Copyright © 2018 Ranchero Software, LLC. All rights reserved. +// + +#import "NSAttributedString+RSCore.h" + +@implementation NSAttributedString (RSCore) + +- (NSAttributedString *)rs_attributedStringByMakingTextWhite { + + NSMutableAttributedString *mutableString = [self mutableCopy]; + [mutableString addAttribute:NSForegroundColorAttributeName value:NSColor.whiteColor range:NSMakeRange(0, mutableString.string.length)]; + return [mutableString copy]; +} + +@end diff --git a/Frameworks/RSCore/RSCore/RSCore.h b/Frameworks/RSCore/RSCore/RSCore.h index 6c832cf8e..658fe5ea4 100755 --- a/Frameworks/RSCore/RSCore/RSCore.h +++ b/Frameworks/RSCore/RSCore/RSCore.h @@ -55,6 +55,7 @@ #import #import +#import #endif