79648763

Date: 2025-06-02 12:59:43
Score: 0.5
Natty:
Report link

To find the closest or similar color in Javascript you will need a comparator. The answer is here on GitHub, as a JavaScript function accepting both RGB and hexadecimal color formats and returning their color difference using the CIE ΔE2000 formula.

Example 1 : Compare Hex vs Hex

// blue compared to darkslateblue
var delta_e = ciede_2000('#00F', '#483D8B')
// ΔE2000 ≈ 15.91 — noticeable difference

Example 2 : Compare Hex vs RGB

// darkslateblue compared to indigo
var delta_e = ciede_2000('#483d8b', 75,0,130)
// ΔE2000 ≈ 12.19 — distinct difference

Example 3 : Compare RGB vs Hex

// indigo compared to darkblue
var delta_e = ciede_2000(75, 0, 130, '#00008b')
// ΔE2000 ≈ 7.72 — moderate difference

Example 4 : Compare RGB vs RGB

// darkblue compared to navy
var delta_e = ciede_2000(0, 0, 139, 0, 0, 128)
// ΔE2000 ≈ 1.56 — slight difference
Reasons:
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Michel