Can we assign 8-bit color values or only 16-bit?

I’ve been working on a script that lets me select some bad-colored text and replace it with pure black while preserving the non-normal colors of all the other text. Here’s the relevant part for my question:

tell application id “DNtp”
 try
  set theText to a reference to selected text of think window 1
  color of attribute runs of theText
  end try
 end tell

Here’s what the AppleScript Editor shows in Replies:

tell application "DEVONthink 3”

get color of every attribute run of selected text of think window 1

→ {{254, 254, 254}, {65535, 0, 0}, {254, 254, 254}}

end tell

Result:

{{254, 254, 254}, {65535, 0, 0}, {254, 254, 254}}

This has always puzzled me, but only today am I first verbalizing it.

I’d like to use 8-bit color assignments, but I’ve always believed that DT forces us to use 16-bit colors. And yet here DT is showing that it does grok 8-bit colors. What’s the real deal? When I examine the text color using the color picker, I get nice hex #DBDBDB. DT will not let us use {219, 219, 219}; we have to use {54110, 54110, 54110} instead.

But now I see that sometimes 8-bit values are allowed. What’s the real deal?

Actually DEVONthink doesn’t handle this on its own, it’s handled by the standard text suite of macOS. This should be identical to e.g. scripting TextEdit.

Got it. Thanks!