Color Value To Hexadecimal


/ Published in: ActionScript 3
Save to your folder(s)

A simple utility class that will help you convert a color value (from numbers) to hexadecimal color value.


Copy this code and paste it in your HTML
  1. package com.vamapaull.utils
  2. {
  3. public class ColorToHexadecimal
  4. {
  5. public static function convertToHexString(number:Number):String
  6. {
  7. var hexColor:String = number.toString(16);
  8. while(hexColor.length < 6)
  9. hexColor = "0" + hexColor;
  10.  
  11. return hexColor;
  12. }
  13. }
  14. }

URL: http://vamapaull.com/color-value-to-hexadecimal/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.