Returns a random 6 digit hexadecimal string from a 96 alphanumeric character set 0-9, A-F, to generate random colors from 16.7 milliom possible combinations.
Parameters
none
Sample Usage
bgcolor="#[lp_color_random]"
Source Code
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
[
/*----------------------------------------------------------------------------
[lp_color_random]
Returns a random 6 digit hexadecimal string.
Author: Ken Wallace, www.sealevel.ca
Last Modified: August 15, 2007
License: Public Domain
Description:
Returns a random 6 digit hexadecimal string from a 96 alphanumeric character set 0-9, A-F, to generate random colors from 16.7 milliom possible combinations.
Sample Usage:
bgcolor="#[lp_color_random]"
----------------------------------------------------------------------------*/
]
[
define_tag:'lp_color_random',
-description='Returns a random 6 digit hexadecimal string.',
-priority='replace',
-optional='length';
// based on a tag by Bil Corry based on a tag by Greg Willits
local:'alphanumeric' = '000000111111222222333333444444555555666666777777888888999999AAAAAABBBBBBCCCCCCDDDDDDEEEEEEFFFFFF';
if: !(local_defined:'length');
local:'length' = 6;
/if;
local:'lp_color_random' = string;
loop:(integer:#length);
#lp_color_random += #alphanumeric->(get:(integer:(math_random: -lower=1, -upper=96)));
/loop;
return: #lp_color_random;
/define_tag;
]