Category: Script Library
Color Codes
Color definitions for use to set color values in fields and console.log().
TapForms has a color option when writing to the console using console.log("some text", "#ff0000"). Apart of white, black, red, green, blue and some shades of gray, it is hard to remember the RGB values of a particular color.
This script provides human readable color codes instead of standard 24-bit RGB patterns. Color codes can be used with console.log output and field colors.
console.log('some random text', COLOR.mediumslateblue);
Following is a list of all web color codes that are supported:
aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, webgray, green, webgreen, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrod, lightgray, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, webmaroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navyblue, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, webpurple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
If you're looking for a particular color, it might be easier to use a reference such as htmlcolorcodes.com
Usage
In order to use this, first the script needs to be loaded with
// load color codes if it is not already loaded
document.getFormNamed('Scripts').runScriptNamed('Color Codes');
Now it's easy to use a color code without remembering a RGB value:
console.log("This test outputs red, green, and blue lines");
console.log("red red red red red", COLOR.red);
console.log("green green green green", COLOR.green);
console.log("blue blue blue blue blue", COLOR.blue);
console.log("violet violet violet violet", COLOR.violet);
With the dark theme, this generates an output like this:

Installation
The Color Codes script is installed using the scriptHandler script about which you can learn more over here. It is installed in the Scripts form.
Dependencies
none
ChangeLog
Link to ChangeLog
Author
- Daniel Leu, info@danielleu.com
Do you like this script? Are you using it? Please consider supporting me by buying me a coffee!
Thanks!
Last modified: Apr 24, 2025 6:24:26 PM
