In the ND7 mail file, there is a feature called “Message Marking” which allows the user to set a custom color for the text and background of view entries sent from anyone in a list of names that the user sets. This feature is handy for highlighting mail sent from specific users like your boss or your project team. The feature is accessed by selecting “Preferences…” from the “Tools” action button at the top of most views and folders in the mail file.One caveat to using this feature has been that, if you set a background color to highlight an entry and the entry is unread, the foreground text will not be highlighted with the unread marks color (red by default). The unread marks is a feature I really rely on and in spite of the fact that a red star still displays in the gutter on the left of the view/folder, I really miss having the text highlighted as an unread indicator. This is made even worse by the fact the any emails that are being marked by the “Message Marking” feature are usually important, so overlooking that they are unread is a big problem.
The code below modifies the mail template so that a custom background color can be set using the “Message Marking” feature, but the text in the views/folders to will continue displaying unread marks as highlighted text. The unread marks will only display if the text is set as Black (RGB 0:0:0 or Hex 00000000). If the foreground text is set to anything but Black in the Preferences dialog, then the selected text color will always display regardless of unread status.
This code has been tested with the ND7 mail file (StdR7Mail version 7.0.2 (07/24/2006)).
Copy the @Formula code below to the Value formula section of the “$Sender1” field in the “(Calendar Profile) | CalendarProfile” form in the mail file. It can replace all of the code currently in that field. Now, I can just hear all the experts out there saying “You should never modify the mail file or mail template!” If you’re uncomfortable with that idea, then I wouldn’t recommend implementing this. I also give no warranties for this code, so use at your own risk.
I should give a big shout to Brendan Higgins for the @Formula code that process the hex color value into RGB.
REM {KW 11/15/2007 - This code will process the color values into RGB values.};
@For(i := 1; i <= 3; i := i + 1;
@For(n := 1; n <= 2; n := n + 1;
HexValue := @RightBack(@Text(@GetField(“Sender” + @Text(i) + @If(n = 1; “B”; “F”))); 2);
a := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Left(HexValue; 1)); “a” : “b” : “c” : “d” : “e” : “f”; “10” : “11” : “12” : “13” : “14” : “15”)
);
b := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Middle(HexValue; 1; 1)); "a" : "b" : "c" : "d" : "e" : "f"; "10" : "11" : "12" : "13" : "14" : "15")
);
c := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Middle(HexValue; 2; 1)); "a" : "b" : "c" : "d" : "e" : "f"; "10" : "11" : "12" : "13" : "14" : "15")
);
d := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Middle(HexValue; 3; 1)); "a" : "b" : "c" : "d" : "e" : "f"; "10" : "11" : "12" : "13" : "14" : "15")
);
e := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Middle(HexValue; 4; 1)); "a" : "b" : "c" : "d" : "e" : "f"; "10" : "11" : "12" : "13" : "14" : "15")
);
f := @TextToNumber(@ReplaceSubstring(
@LowerCase(@Middle(HexValue; 5; 1)); "a" : "b" : "c" : "d" : "e" : "f"; "10" : "11" : "12" : "13" : "14" : "15")
);
R := @Text((a*16) + b);
G := @Text((c*16) + d);
B := @Text((e*16) + f);
@If(
(R+":"+G+":"+B) = "0:0:0";
@Set("Sender" + @Text(i) + @If(n = 1; "B"; "F") + "Alt"; "-1:-1:-1");
@Set("Sender" + @Text(i) + @If(n = 1; "B"; "F") + "Alt"; (R+":"+G+":"+B))
)
)
);
REM {KW 11/15/2007 - This is the original code in this field. If you need to revert, however, use the original field code for this field, which can be found in the database template for this mail file (StdR7Mail version 7.0.2 (07/24/2006))};
@If(tmpColorButton = “1”; “”;
"PriName := @If(@IsAvailable(Principal) & Principal != ""; Principal; from);
AltName := @If(@IsAvailable($AltPrincipal) & $AltPrincipal != ""; $AltPrincipal; @IsAvailable(AltFrom) & AltFrom != ""; AltFrom; "");
FromName := @LowerCase(@If(AltName != ""; PriName : AltName; PriName));
ChairName := @LowerCase(@If(@IsAvailable(AltChair) & AltChair != ""; Chair : AltChair; Chair));
IRName := @LowerCase(@If(@IsAvailable(AltIntendedRecipient) & AltIntendedRecipient != ""; AltIntendedRecipient : IntendedRecipient; IntendedRecipient));
LCfrom := @If(form = "Return Receipt"; IRName; form = "(ReplyNotice)"; ChairName; FromName);
list1 := " + ImplodeSender1List + ";
list2 := " + ImplodeSender2List + ";
list3 := " + ImplodeSender3List + ";
S_1B := " + Sender1BAlt + ";
S_1F := " + Sender1FAlt + ";
S_2B := " + Sender2BAlt + ";
S_2F := " + Sender2FAlt + ";
S_3B := " + Sender3BAlt + ";
S_3F := " + Sender3FAlt + ";
color1 := S_1B : S_1F ;
color2 := S_2B : S_2F;
color3 := S_3B : S_3F;
@If(@Contains(LCfrom; list1) & list1 != ""; color1; @contains(LCFrom; list2) & list2 != ""; color2; @contains(LCFrom; list3) & list3 != ""; color3; "")")