Color conversion functions for JavaScript