Maybe again dummy question about attributed string colors

I got attributed strings (a real lot of them) and I want to convert them to some “html-like” text with color and style flags

I could use

set theDict to cA's NSDictionary's dictionaryWithObjects:{cA's NSHTMLTextDocumentType, elementsToSkip} forKeys:{cA's NSDocumentTypeDocumentAttribute, cA's NSExcludedElementsDocumentAttribute}
set {htmlData, theError} to theAttrStr's dataFromRange:{0, theAttrStr's |length|()} documentAttributes:theDict |error|:(reference)
		if htmlData = missing value then error theError's localizedDescription() as text
set htmlString to (cA's NSString's alloc()'s initWithData:htmlData encoding:(cA's NSUTF8StringEncoding)) as text

or the attribute run approach which was shown here (by Nigel I think)

set {theAtts, theRange} to theAttrStr's attributesAtIndex:startIndex longestEffectiveRange:(reference) inRange:{startIndex, theLength - startIndex}
set aColor to (theAtts's valueForKeyPath:"NSColor")

Up to now I thought the first approach should work fine with minimal (and standard) code.
Yesterday I figured out it produces “garbage” in regards of color.
If I apply a color like “00FF00” (Teletext Green, TTML Lime) to a text and use the first approach I get something like “23FF06”.
The other approach correctly reports “0,1,0” -> “00FF00”.
I (again) feel as a kind of idiot cause I don’t understand why.
The only consolation: a pricy commercial package can’t handle as well and returns “00FA00”

Any idea where to send my thoughts :wink: