Dynamic Background Color
Have you ever wanted to have a little different background color for each document in a database? Maybe based on a certain document status you would want to change the background color. There's a reserved Notes field called $PaperColor which can be used to set the background color on an individual document.First, set up a keyword field that has all the possible background colors. The formula choices for the keyword field are:
"black" : "white" : "red" : "green" : "blue" : "magenta" : "yellow" : "cyan" : "dark red" : "dark green" : "dark blue" : "dark magenta" : "dark yellow" : "dark cyan" : "gray" : "light gray" : "white" : "vanilla" : "parchment" : "ivory" : "pale green" : "sea mist" : "ice blue" : "powder blue" : "arctic blue" : "lilac mist" : "purple wash" : "violet frost" : "seashell" : "rose pearl" : "pale cherry" : "white" : "blush" : "sand" : "light yellow" : "honeydew" : "celery" : "pale aqua" : "pale blue" : "crystal blue" : "light cornflower" : "pale lavender" : "grape fizz" : "pale plum" : "pale pink" : "pale rose" : "rose quartz" : "5% gray" : "red sand" : "buff" : "lemon" : "pale lemon lime" : "mint green" : "pastel green" : "pastel blue" : "sapphire" : "cornflower" : "light lavender" : "pale purple" : "light orchid" : "pink orchid" : "apple blossom" : "pink coral" : "10% gray" : "light salmon" : "light peach" : "yellow" : "avocado" : "leaf green" : "light aqua" : "light turquoise" : "light cerulean" : "azure" : "lavender" : "light purple" : "dusty violet" : "pink" : "pastel pink" : "pastel red" : "15% gray" : "salmon" : "peach" : "mustard" : "lemon lime" : "neon green" : "aqua" : "turquoise" : "cerulean" : "wedgewood" : "heather" : "purple haze" : "orchid" : "flamingo" : "cherry pink" : "red coral" : "20% gray" : "dark salmon" : "dark peach" : "gold" : "yellow green" : "light green" : "caribbean" : "dark pastel blue" : "dark cerulean" : "manganese blue" : "lilac" : "purple" : "light red violet" : "light magenta" : "rose" : "carnation pink" : "25% gray" : "watermelon" : "tangerine" : "orange" : "chartreuse" : "green" : "teal" : "dark turquoise" : "light slate blue" : "medium blue" : "dark lilac" : "royal purple" : "fuchsia" : "confetti pink" : "pale burgundy" : "strawberry" : "30% gray" : "rouge" : "burnt orange" : "dark orange" : "light olive" : "kelly green" : "sea green" : "aztec blue" : "dusty blue" : "blueberry" : "violet" : "deep purple" : "red violet" : "hot pink" : "dark rose" : "poppy red" : "35% gray" : "crimson" : "red" : "light brown" : "olive" : "dark green" : "dark teal" : "spruce" : "slate blue" : "navy blue" : "blue violet" : "amethyst" : "dark red violet" : "magenta" : "light burgundy" : "cherry red" : "40% gray" : "dark crimson" : "dark red" : "hazelnut" : "dark olive" : "emerald" : "malachite" : "dark spruce" : "steel blue" : "blue" : "iris" : "grape" : "plum" : "dark magenta" : "burgundy" : "cranberry" : "50% gray" : "mahogany" : "brick" : "dark brown" : "deep olive" : "dark emerald" : "evergreen" : "baltic blue" : "blue denim" : "cobalt blue" : "dark iris" : "midnight" : "dark plum" : "plum red" : "dark burgundy" : "scarlet" : "60% gray" : "chestnut" : "terra cotta" : "umber" : "amazon" : "peacock green" : "pine" : "seal blue" : "dark slate blue" : "royal blue" : "lapis" : "dark grape" : "aubergine" : "dark plum red" : "raspberry" : "deep scarlet" : "70% gray" : "red gray" : "tan" : "khaki" : "putty" : "bamboo green" : "green gray" : "baltic gray" : "blue gray" : "rain cloud" : "lilac gray" : "light purple gray" : "light mauve" : "light plum gray" : "light burgundy gray" : "rose gray" : "80% gray" : "dark red gray" : "dark tan" : "safari" : "olive gray" : "jade" : "dark green gray" : "spruce gray" : "dark blue gray" : "atlantic gray" : "dark lilac gray" : "purple gray" : "mauve" : "plum gray" : "burgundy gray" : "dark rose gray" : "black"
Then add a hidden, computed field called $PaperColor (this must be the exact name) to your document. Here's the formula for that field:
@Member(BgColor; "black" : "white" : "red" : "green" : "blue" : "magenta" : "yellow" : "cyan" : "dark red" : "dark green" : "dark blue" : "dark magenta" : "dark yellow" : "dark cyan" : "gray" : "light gray" : "white" : "vanilla" : "parchment" : "ivory" : "pale green" : "sea mist" : "ice blue" : "powder blue" : "arctic blue" : "lilac mist" : "purple wash" : "violet frost" : "seashell" : "rose pearl" : "pale cherry" : "white" : "blush" : "sand" : "light yellow" : "honeydew" : "celery" : "pale aqua" : "pale blue" : "crystal blue" : "light cornflower" : "pale lavender" : "grape fizz" : "pale plum" : "pale pink" : "pale rose" : "rose quartz" : "5% gray" : "red sand" : "buff" : "lemon" : "pale lemon lime" : "mint green" : "pastel green" : "pastel blue" : "sapphire" : "cornflower" : "light lavender" : "pale purple" : "light orchid" : "pink orchid" : "apple blossom" : "pink coral" : "10% gray" : "light salmon" : "light peach" : "yellow" : "avocado" : "leaf green" : "light aqua" : "light turquoise" : "light cerulean" : "azure" : "lavender" : "light purple" : "dusty violet" : "pink" : "pastel pink" : "pastel red" : "15% gray" : "salmon" : "peach" : "mustard" : "lemon lime" : "neon green" : "aqua" : "turquoise" : "cerulean" : "wedgewood" : "heather" : "purple haze" : "orchid" : "flamingo" : "cherry pink" : "red coral" : "20% gray" : "dark salmon" : "dark peach" : "gold" : "yellow green" : "light green" : "caribbean" : "dark pastel blue" : "dark cerulean" : "manganese blue" : "lilac" : "purple" : "light red violet" : "light magenta" : "rose" : "carnation pink" : "25% gray" : "watermelon" : "tangerine" : "orange" : "chartreuse" : "green" : "teal" : "dark turquoise" : "light slate blue" : "medium blue" : "dark lilac" : "royal purple" : "fuchsia" : "confetti pink" : "pale burgundy" : "strawberry" : "30% gray" : "rouge" : "burnt orange" : "dark orange" : "light olive" : "kelly green" : "sea green" : "aztec blue" : "dusty blue" : "blueberry" : "violet" : "deep purple" : "red violet" : "hot pink" : "dark rose" : "poppy red" : "35% gray" : "crimson" : "red" : "light brown" : "olive" : "dark green" : "dark teal" : "spruce" : "slate blue" : "navy blue" : "blue violet" : "amethyst" : "dark red violet" : "magenta" : "light burgundy" : "cherry red" : "40% gray" : "dark crimson" : "dark red" : "hazelnut" : "dark olive" : "emerald" : "malachite" : "dark spruce" : "steel blue" : "blue" : "iris" : "grape" : "plum" : "dark magenta" : "burgundy" : "cranberry" : "50% gray" : "mahogany" : "brick" : "dark brown" : "deep olive" : "dark emerald" : "evergreen" : "baltic blue" : "blue denim" : "cobalt blue" : "dark iris" : "midnight" : "dark plum" : "plum red" : "dark burgundy" : "scarlet" : "60% gray" : "chestnut" : "terra cotta" : "umber" : "amazon" : "peacock green" : "pine" : "seal blue" : "dark slate blue" : "royal blue" : "lapis" : "dark grape" : "aubergine" : "dark plum red" : "raspberry" : "deep scarlet" : "70% gray" : "red gray" : "tan" : "khaki" : "putty" : "bamboo green" : "green gray" : "baltic gray" : "blue gray" : "rain cloud" : "lilac gray" : "light purple gray" : "light mauve" : "light plum gray" : "light burgundy gray" : "rose gray" : "80% gray" : "dark red gray" : "dark tan" : "safari" : "olive gray" : "jade" : "dark green gray" : "spruce gray" : "dark blue gray" : "atlantic gray" : "dark lilac gray" : "purple gray" : "mauve" : "plum gray" : "burgundy gray" : "dark rose gray" : "black") - 1
Now individual documents can have a unique background color.
Note: Page 2 of this hint lists the choices straight down a list, so you could use hard-coded values instead of the formulas.
Note: This field is recalculated only when the document opens. This means that if you change the value on a document, you won't see the change until the document is closed and re-opened.
Note: DO NOT CHANGE THE FORMULA FOR $PAPERCOLOR. You can get rid of some of the keyword choices if you want (e.g., you may not want to have "black" as a background option if you have black text) but $PaperColor shouldn't be changed. $PaperColor actually stores a number value and that number value is what's used for the background color. So the formula is very important so that the correct number can be stored in the document. You don't need to go through all the translation if you know what number to put into $PaperColor, but we prefer this method (you can actually associate a name with the color).
Note: This functionality works better on the web than through Notes, and works better through Notes if the field is stored as part of the document (and therefore is changed programatically).