[lp_color_random]

Description

Link: [lp_color_random]
Author: Ken Wallace
Category: Utility
Version: 8.5.x
License: Public Domain
Posted: Oct. 03, 2007
Updated: Oct. 03, 2007
More by this author...
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[
/*----------------------------------------------------------------------------

[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;

]

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net