About Box: help with declares

my app relies on macosLib to create a AboutBox with a string localized in various languages. It has always worked all right. And it still works all right in LightMode.

But when I switch to DarkMode, then the background turns black, but the text too remains black.
What to do to have the text show up white?

Suggestions welcome. Thanks you.

Below is the relevant part of the code I use. I guess “NSForegroundColorAttributeName” should be added, but I do not know where or how.

dim s as string = myLocalizedString
dim keys() as NSObject
dim objs() as NSObject
keys.Append new NSString(“Credits”)
objs.Append new NSAttributedString(s)//in DarkMode it remains black over black background
dim d as new NSDictionary(keys, objs)

Theoretically this should work if not the AttributedString has a Color attribute linked to Black instead of TextColor by default. I do not work with MacOSLib, therefore just guessing. Have you analyzed the attributes of the string?

If nothing suspicious, you would indeed have to add a ForegroundColor attribute to the whole string. Again, I do not know the implementation details, but basically AttributedString should have some function like AddAttribute where you define the span of the string (in this case the whole string length), the attribute (which could be the string constant you mentioned if there is no convenience dictionary class or similar for it in MacOSLib) and the value, possibly a ptr to NSColor.TextColor.

Thank you: I’ll try to see what I can do with your suggestion, that clarifies something I thought was not correlated in my case (like the span etc. that you mentioned).

So I implemented it feeding a html string with color set to green, that can be seen both in light and darkMode.

keys.Append new NSString(“Credits”)
dim RTFdata as NSData = new NSData(s)//html string constant
dim nsas as NSAttributedString = NSAttributedString.CreateFromHTML(RTFdata)
objs.Append new NSAttributedString(nsas)