Duibi
Library and tool to check colour contrast accessibility of elements in a web pages.
CLI usage
Install globally as a tool:
npm install -g duibi
And use it!
Usage $ duibi <url> <container selector> <text selector> Examples $ duibi 'https://www.klarna.com/se/' '.block-hero__title'
Library usage
Install it locally in your project:
npm install --save duibi
And call it directly:
The result
object contains:
backgroundAverageColor: 'rgba(255,255,255,1)' foregroundColor: 'rgb(217, 177, 177)' ratio: 1931200716492237 score: 'F' isAccessible: false backgroundScreenshotPath: '/var/folders/gm/bnfrz1.1dw45.png' containerScreenshotPath: '/var/folders/gm/36100-1rbuk51.ftfb.png'