  
res // 14.143
`
you can also pass values as strings, values dont have to be the same type
`typescript
import { deltaE } from 'color-delta-e'
const res = deltaE(
'rgb(55,117,192)',
'#0e51a2', // the types will be inferred when using strings!
)
res // 14.143
`
#### Cached Results
deltaE automatically caches results, in order to save calculation of the same colors, if you need to clear this cache in order to remove a potential memory leak there are two options.
#### nocache option`typescript
import { deltaE } from 'color-delta-e'
const res = deltaE(
[55,117,192],
[14,81,162],
'rgb',
true, //nocache option: when set to tru will not cache the result.
)
`
#### clearCache
`typescript
import { deltaE, clearCache } from 'color-delta-e'
deltaE('#BADA55', '#C0FFEE') //result cached
deltaE('#BADA55', '#C0FFEE') // cached result returned
clearCache()
deltaE('#BADA55', '#C0FFEE') // value recalculated and cached
`
takes two numbers an returns a boolean indicating if the value is above the threshold default: 5
`typescript
import { isPerceivable } from 'color-delta-e'
if(isPerceivable([55,117,192],[14,81,162])){
// do stuff
}
`
or white which ever contrasts best with provided color, the return type will be in same format inputted, so and rgb string will return an rgb string, a hex string will return a hex string.
`typescript
import { contrastText } from 'color-delta-e'const res = contrastText([0,0,0])
res // '[255,255,255]'
`
$3
takes in base options including base color to compare to, and threshold. rest arguments are a list of fallback colors to go through. selector will return the first color that has a perceptible contrast that meets the threshold provided. If no contrasting values found, will return the last fallback provided.`typescript
import { selector } from 'color-delta-e'const res = selector({
compare: [0, 0, 0]
},
[0, 1, 0],
[0, 2, 0],
[200, 30, 10],
[255, 255, 255]
);
res // [200, 30, 10]
`
values dont have to be the same type
`typescript
import { selector } from 'color-delta-e'const res = selector({
compare: 'hsl(0, 0%, 0%)'
},
'rgb(0, 1, 0)',
'#002200',
[200, 30, 10],
[255, 255, 255]
);
res // [200, 30, 10]
`
$3
takes in an
HTMLImageElement will sample the image and return the average(median) color in image.only works in browser environments.
doesn't support crossOrigin images.
`typescript
import { sampleImage } from 'color-delta-e'const myImgEl = document.querySelector('img')
const res = sampleImage(myImgEl)
res // [100, 23, 221]
``