Lasso Soft Inc. > Home

[pk_hextorgb]

Linkpk_hextorgb
AuthorPier Kuipers
CategoryString
Version8.x
LicensePublic Domain
Posted10 Jan 2006
Updated16 Jan 2006
More by this author...

Description

Tag accepts a HTML hexadecimal colour value such as "#f45a49" or "#FFF" and converts it to a space delimited RGB value such as "255 255 255".

Sample Usage

[pk_hextorgb:'#fff']
-> 255 255 255

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.

 (uppercase);

			if: (#myhex -> size == 3);
				local:'temphex'=string;
				loop: 3;
					#temphex += (#myhex -> get:(loop_count));
					#temphex += (#myhex -> get:(loop_count));
				/loop;			
				#myhex = #temphex;
			else: (#myhex -> size > 6) || (#myhex -> size < 6);
				#myhex = 'ffffff';
			/if;
			
			loop: 6;
				if:!(#hexvalues -> contains:(#myhex -> get:(loop_count)));
					#myhex = 'ffffff';
				/if;
			/loop;
			
			local:'rgbstring'=string;
			local:'looparray'= (: 1, 3, 5);

			iterate: #looparray, local:'tmp';
				local:'mydecimal'=(#hexvalues -> find:(#myhex -> get:(#tmp)));
				local:'tens'=((integer:(#mydecimal - 1)) * 16);
				local:'ones'=(integer:(#hexvalues -> find:(#myhex -> get:(#tmp + 1))));
				#rgbstring += (string:(#tens + (#ones - 1))) + ' ';
			/iterate;

			#rgbstring -> trim;
			return:#rgbstring;
			
		/define_tag;
	
	/if;

?>

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft