3 ms·
The HTML5 color parsing algorithm is less complex than it seems. Mostly it boils down to "take any characters that aren't hex digits and replace them with zeroe
by ubernostrum 9y ago
The HTML5 color parsing algorithm is less complex than it seems. Mostly it boils down to "take any characters that aren't hex digits and replace them with zeroes, then truncate the resulting string in a consistent way to produce a 24-bit value".