| 6884 | return a; |
| 6885 | }, |
| 6886 | _formatColors = function(s, toHSL) { |
| 6887 | var colors = s.match(_colorExp) || [], |
| 6888 | charIndex = 0, |
| 6889 | parsed = colors.length ? "" : s, |
| 6890 | i, color, temp; |
| 6891 | for (i = 0; i < colors.length; i++) { |
| 6892 | color = colors[i]; |
| 6893 | temp = s.substr(charIndex, s.indexOf(color, charIndex)-charIndex); |
| 6894 | charIndex += temp.length + color.length; |
| 6895 | color = _parseColor(color, toHSL); |
| 6896 | if (color.length === 3) { |
| 6897 | color.push(1); |
| 6898 | } |
| 6899 | parsed += temp + (toHSL ? "hsla(" + color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : "rgba(" + color.join(",")) + ")"; |
| 6900 | } |
| 6901 | return parsed; |
| 6902 | }, |
| 6903 | _colorExp = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#.+?\\b"; //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc. |
| 6904 | |
| 6905 | for (p in _colorLookup) { |