Get started with color-name-list CDN

MIT licensed

Library maps color names to hex codes: color-name-list in JS.

Tags:
  • colors
  • color
  • names
  • naming

Stable version

Copied!

How to start using color-name-list CDN


// Import the color-name-list library
import colors from 'https://cdn.cdnhub.io/color-name-list/10.20.2/colornames.umd.js';

// Create a select element for color names
const colorSelect = document.createElement('select');
document.body.appendChild(colorSelect);

// Get all color names from the library
colors.names.then((colorNames) => {
  // Populate the select element with color names
  colorNames.forEach((colorName) => {
    const option = document.createElement('option');
    option.value = colorName;
    option.textContent = colorName;
    colorSelect.appendChild(option);
  });
});
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions