MCPcopy Create free account
hub / github.com/easydiffusion/easydiffusion / hexToRgb

Function hexToRgb

ui/media/js/image-editor.js:847–856  ·  view source on GitHub ↗
(hex)

Source from the content-addressed store, hash-verified

845}
846
847function hexToRgb(hex) {
848 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
849 return result
850 ? {
851 r: parseInt(result[1], 16),
852 g: parseInt(result[2], 16),
853 b: parseInt(result[3], 16),
854 }
855 : null
856}
857
858function pixelCompare(int1, int2) {
859 return Math.abs(int1 - int2) < 4

Callers 1

image-editor.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected