The first code I attempted to do it with is just setting the text color to black or white based on an average of the RGB values divided by 2, which actually works out not too bad, but did have some inconsistencies...
Code: Select all
put the backgroundColor of line x of field 1 into tmpCol
# determine a color offset to decide whether to use black or white text...
if sum(tmpCol) /2 < 160 then
set the textColor of line x of field 1 to "white"
else
set the textColor of line x of field 1 to "black"
end if
Code: Select all
put (255 - item 1 of tmpCol) & comma into tmpText1; put (255 - item 2 of tmpCol) & comma after tmpText1; put (255 - item 3 of tmpCol) after tmpText1;
set the textColor of line x of field 1 to tmpText1
Code: Select all
if item 1 of tmpCol > 180 then
put 55 into item 1 of tmpCol
else
put 180 into item 1 of tmpCol
end if
if item 2 of tmpCol > 180 then
put 55 into item 2 of tmpCol
else
put 180 into item 2 of tmpCol
end if
if item 3 of tmpCol > 180 then
put 55 into item 3 of tmpCol
else
put 180 into item 3 of tmpCol
end if
set the textColor of line x of field 1 to tmpCol
What I'd be really interested in reading is someone that knows how to do something *like* setting the ink, which works out great in the script editor, but in a way where it takes the background color of each line into account.
Alternately, if someone knows how to simulate doing that, or just plain has a better way I haven't already thunk of
