Index of /test/html/parsing/color-attributes/the-algorithm

      Name                    Last modified      Size  Description
Parent Directory - 001.htm 2007-09-17 10:26 12K HTML color attribute processing tests (quirks mode) 002.htm 2007-09-17 10:26 12K HTML color attribute processing tests (standards mode) 003.htm 2007-09-17 10:29 189 the empty string (quirks mode) 004.htm 2007-09-17 10:29 208 the empty string (standards mode)
   1. If the string is the empty string, act as if the attribute was
      absent and abort these steps.
   2. If the string ASCII-case-insensitively matches a css3-color keyword
      or one of the CSS2 System Colors, or is "transparent"
      (ASCII-case-insensitively), use that and abort these steps.
   3. Trim all but the first 128 chars from the string.
   4. If it exists, strip the first leading #.
   5. Replace non-valid-hex chars with 0s.
   6. ASCII-lower-case the string.
   7. Make string length a multiple of 3 and a minimum of 3 by appending
   8. Split the string into 3 equal segments.
   9. Trim all but the right-most 8 chars from each segment.
  10. If segment length is 1, left-pad each segment with a 0, else:
  11. While segment length is greater than 2 and the first char of each
      segment is equal to 0, trim the left-most char from each segment,
  12. Trim all but the first 2 chars from each segment.
  13. Join the segments and append them to a # char to create the final

Also see: