diff --git a/Cauldron.Macos/SourceWriter/LanguageDescriptor.cs b/Cauldron.Macos/SourceWriter/LanguageDescriptor.cs index eacc3a1..c48cc19 100644 --- a/Cauldron.Macos/SourceWriter/LanguageDescriptor.cs +++ b/Cauldron.Macos/SourceWriter/LanguageDescriptor.cs @@ -32,7 +32,8 @@ public class LanguageDescriptor : NSObject /// the keywords for this language. /// /// The keywords. - public Dictionary Keywords { get; set; } = new Dictionary(); + public Dictionary Keywords { get; set; } + = new Dictionary(); /// /// Gets or sets the collection of formats used to syntax @@ -61,7 +62,7 @@ public class LanguageDescriptor : NSObject [Export("KeywordColor")] public NSColor KeywordColor { - get => LoadColor("KeywordColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("KeywordColor", NSColor.SystemTeal); set { WillChangeValue("KeywordColor"); @@ -75,7 +76,7 @@ public class LanguageDescriptor : NSObject [Export("TypeColor")] public NSColor TypeColor { - get => LoadColor("TypeColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("TypeColor", NSColor.SystemTeal); set { WillChangeValue("TypeColor"); @@ -89,7 +90,7 @@ public class LanguageDescriptor : NSObject [Export("ValueTypeColor")] public NSColor ValueTypeColor { - get => LoadColor("ValueTypeColor", NSColor.Blue); + get => LoadColor("ValueTypeColor", NSColor.SystemBlue); set { WillChangeValue("ValueTypeColor"); @@ -103,7 +104,7 @@ public class LanguageDescriptor : NSObject [Export("ReferenceTypeColor")] public NSColor ReferenceTypeColor { - get => LoadColor("ReferenceTypeColor", NSColor.FromRgba(0f, 0.56f, 0.80f, 1.0f)); + get => LoadColor("ReferenceTypeColor", NSColor.SystemCyan); set { WillChangeValue("ReferenceTypeColor"); @@ -117,7 +118,7 @@ public class LanguageDescriptor : NSObject [Export("AccessModifierColor")] public NSColor AccessModifierColor { - get => LoadColor("AccessModifierColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("AccessModifierColor", NSColor.SystemTeal); set { WillChangeValue("AccessModifierColor"); @@ -131,7 +132,7 @@ public class LanguageDescriptor : NSObject [Export("ModifierColor")] public NSColor ModifierColor { - get => LoadColor("ModifierColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("ModifierColor", NSColor.SystemTeal); set { WillChangeValue("ModifierColor"); @@ -145,7 +146,7 @@ public class LanguageDescriptor : NSObject [Export("SelectionStatementColor")] public NSColor SelectionStatementColor { - get => LoadColor("SelectionStatementColor", NSColor.FromRgba(0.50f, 0.25f, 0f, 1.0f)); + get => LoadColor("SelectionStatementColor", NSColor.SystemBrown); set { WillChangeValue("SelectionStatementColor"); @@ -159,7 +160,7 @@ public class LanguageDescriptor : NSObject [Export("IterationStatementColor")] public NSColor IterationStatementColor { - get => LoadColor("IterationStatementColor", NSColor.FromRgba(0.50f, 0f, 0f, 1.0f)); + get => LoadColor("IterationStatementColor", NSColor.SystemRed); set { WillChangeValue("IterationStatementColor"); @@ -173,7 +174,7 @@ public class LanguageDescriptor : NSObject [Export("JumpStatementColor")] public NSColor JumpStatementColor { - get => LoadColor("JumpStatementColor", NSColor.FromRgba(0.50f, 0.50f, 0.0f, 1.0f)); + get => LoadColor("JumpStatementColor", NSColor.SystemYellow); set { WillChangeValue("JumpStatementColor"); @@ -187,7 +188,7 @@ public class LanguageDescriptor : NSObject [Export("ExceptionHandlingColor")] public NSColor ExceptionHandlingColor { - get => LoadColor("ExceptionHandlingColor", NSColor.FromRgba(1f, 0f, 0f, 1.0f)); + get => LoadColor("ExceptionHandlingColor", NSColor.SystemRed); set { WillChangeValue("ExceptionHandlingColor"); @@ -201,7 +202,7 @@ public class LanguageDescriptor : NSObject [Export("StatementColor")] public NSColor StatementColor { - get => LoadColor("StatementColor", NSColor.FromRgba(1f, 0f, 0.50f, 1.0f)); + get => LoadColor("StatementColor", NSColor.SystemPink); set { WillChangeValue("StatementColor"); @@ -215,7 +216,7 @@ public class LanguageDescriptor : NSObject [Export("MethodParameterColor")] public NSColor MethodParameterColor { - get => LoadColor("MethodParameterColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("MethodParameterColor", NSColor.SystemTeal); set { WillChangeValue("MethodParameterColor"); @@ -229,7 +230,7 @@ public class LanguageDescriptor : NSObject [Export("NamespaceColor")] public NSColor NamespaceColor { - get => LoadColor("NamespaceColor", NSColor.FromRgba(0.06f, 0.52f, 0.50f, 1.0f)); + get => LoadColor("NamespaceColor", NSColor.SystemTeal); set { WillChangeValue("NamespaceColor"); @@ -243,7 +244,7 @@ public class LanguageDescriptor : NSObject [Export("OperatorKeywordColor")] public NSColor OperatorKeywordColor { - get => LoadColor("OperatorKeywordColor", NSColor.FromRgba(0.80f, 0.40f, 1f, 1.0f)); + get => LoadColor("OperatorKeywordColor", NSColor.SystemPurple); set { WillChangeValue("OperatorKeywordColor"); @@ -257,7 +258,7 @@ public class LanguageDescriptor : NSObject [Export("ConversionKeywordColor")] public NSColor ConversionKeywordColor { - get => LoadColor("ConversionKeywordColor", NSColor.Purple); + get => LoadColor("ConversionKeywordColor", NSColor.SystemPurple); set { WillChangeValue("ConversionKeywordColor"); @@ -271,7 +272,7 @@ public class LanguageDescriptor : NSObject [Export("AccessKeywordColor")] public NSColor AccessKeywordColor { - get => LoadColor("AccessKeywordColor", NSColor.Purple); + get => LoadColor("AccessKeywordColor", NSColor.SystemPurple); set { WillChangeValue("AccessKeywordColor"); @@ -285,7 +286,7 @@ public class LanguageDescriptor : NSObject [Export("LiteralKeywordColor")] public NSColor LiteralKeywordColor { - get => LoadColor("LiteralKeywordColor", NSColor.Purple); + get => LoadColor("LiteralKeywordColor", NSColor.SystemPurple); set { WillChangeValue("LiteralKeywordColor"); @@ -299,7 +300,7 @@ public class LanguageDescriptor : NSObject [Export("ContextualKeywordColor")] public NSColor ContextualKeywordColor { - get => LoadColor("ContextualKeywordColor", NSColor.FromRgba(0f, 0.50f, 0.25f, 1.0f)); + get => LoadColor("ContextualKeywordColor", NSColor.SystemGreen); set { WillChangeValue("ContextualKeywordColor"); @@ -313,7 +314,7 @@ public class LanguageDescriptor : NSObject [Export("QueryKeywordColor")] public NSColor QueryKeywordColor { - get => LoadColor("QueryKeywordColor", NSColor.Orange); + get => LoadColor("QueryKeywordColor", NSColor.SystemOrange); set { WillChangeValue("QueryKeywordColor"); @@ -327,7 +328,7 @@ public class LanguageDescriptor : NSObject [Export("PreprocessorDirectiveColor")] public NSColor PreprocessorDirectiveColor { - get => LoadColor("PreprocessorDirectiveColor", NSColor.FromRgba(0.69f, 0.03f, 0.61f, 1.0f)); + get => LoadColor("PreprocessorDirectiveColor", NSColor.SystemPurple); set { WillChangeValue("PreprocessorDirectiveColor"); @@ -341,7 +342,7 @@ public class LanguageDescriptor : NSObject [Export("CommentColor")] public NSColor CommentColor { - get => LoadColor("CommentColor", NSColor.Gray); + get => LoadColor("CommentColor", NSColor.SystemGray); set { WillChangeValue("CommentColor"); @@ -355,7 +356,7 @@ public class LanguageDescriptor : NSObject [Export("StringLiteralColor")] public NSColor StringLiteralColor { - get => LoadColor("StringLiteralColor", NSColor.Orange); + get => LoadColor("StringLiteralColor", NSColor.SystemOrange); set { WillChangeValue("StringLiteralColor"); diff --git a/Cauldron.Macos/SourceWriter/LanguageFormatter.cs b/Cauldron.Macos/SourceWriter/LanguageFormatter.cs index 8edaba2..77f4812 100644 --- a/Cauldron.Macos/SourceWriter/LanguageFormatter.cs +++ b/Cauldron.Macos/SourceWriter/LanguageFormatter.cs @@ -309,6 +309,8 @@ public class LanguageFormatter : NSObject { TextEditor.LayoutManager.RemoveTemporaryAttribute( NSStringAttributeKey.ForegroundColor, range); + TextEditor.LayoutManager.SetTemporaryAttributes( + new NSDictionary(NSStringAttributeKey.ForegroundColor, NSColor.ControlText), range); } } catch diff --git a/Cauldron.Macos/SourceWriter/SourceTextView.cs b/Cauldron.Macos/SourceWriter/SourceTextView.cs index 4447334..b38a995 100644 --- a/Cauldron.Macos/SourceWriter/SourceTextView.cs +++ b/Cauldron.Macos/SourceWriter/SourceTextView.cs @@ -193,18 +193,14 @@ public class SourceTextView : NSTextView #region Constructors - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. public SourceTextView() { // Init Initialize(); } - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// Frame rect. public SourceTextView(CGRect frameRect) : base(frameRect) { @@ -212,9 +208,7 @@ public class SourceTextView : NSTextView Initialize(); } - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// Frame rect. /// Container. public SourceTextView(CGRect frameRect, NSTextContainer container) : base(frameRect, container) @@ -223,9 +217,7 @@ public class SourceTextView : NSTextView Initialize(); } - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// Coder. public SourceTextView(NSCoder coder) : base(coder) { @@ -233,25 +225,18 @@ public class SourceTextView : NSTextView Initialize(); } - /// - /// Initializes a new instance of the class. - /// + /// Initializes a new instance of the class. /// Handle. public SourceTextView(IntPtr handle) : base(handle) { - // Init Initialize(); } - /// - /// Initialize this instance. - /// + /// Initialize this instance. private void Initialize() { - - // Init this.Delegate = new SourceTextViewDelegate(this); - + this.UsesAdaptiveColorMappingForDarkAppearance = true; } #endregion