Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.14 KB

README.md

File metadata and controls

57 lines (41 loc) · 1.14 KB

Duibi

Build Status npm version

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:

import duibi from '..'

duibi({
  url: 'https://www.klarna.com/se/',
  containerSelector: '.block-hero__title',
}).then(result => console.log('done', result), error => console.log('error', error))

The result object contains:

{
  backgroundAverageColor: 'rgba(255,255,255,1)',
  foregroundColor: 'rgb(217, 177, 177)',
  ratio: 1.931200716492237,
  score: 'F',
  isAccessible: false,
  backgroundScreenshotPath: '/var/folders/gm/bnfrz1.1dw45.png',
  containerScreenshotPath: '/var/folders/gm/36100-1rbuk51.ftfb.png',
}