June 19 2016

Javascript convert MSAccess color code to Hex color code

Tagged Under : ,

javascript
Because CSS not support MSAccess color code. If want use the MSAccess color code as color display on web. We need change the code to Hexadecimal Code.

Below is the example function to convert MSAccess color code to Hexadecimal color code:
function AccessToHex($a) {
	var $ac = Number($a).toString(16)
	while($ac.length < 6){
	  $ac = '0' + $ac;
	}
	return "#"+$ac.slice(4,6)+$ac.slice(2,4)+$ac.slice(0,2);
}
Just insert the MSAccess color code to the function it will return the Hexadecimal code to you.
AccessToHex('8388608')
The Output:
#800000

Make a Comment

You must be logged in to post a comment.