UNPKG

accessible-color-contrast

Version:

CLI tool which checks two colors for a high enough contrast in the context of WCAG 2.2

35 lines (30 loc) 1.12 kB
import colors from '@colors/colors' import Table from 'cli-table3' export const createTable = () => { const table = new Table({ head: [ '', { hAlign: 'center', content: colors.bold('AA Large Text') }, { hAlign: 'center', content: colors.bold('AA Normal Text') }, { hAlign: 'center', content: colors.bold('AAA Large Text') }, { hAlign: 'center', content: colors.bold('AAA Normal Text') }, ], style: { head: [] }, colWidths: [25, 25, 25, 25, 25], }) table.push([ 'Required Contrast Ratio', { hAlign: 'center', content: '3:1' }, { hAlign: 'center', content: '4.5:1' }, { hAlign: 'center', content: '4.5:1' }, { hAlign: 'center', content: '7:1' }, ]) table.push([ 'Required Font Size', { hAlign: 'center', content: '1.5rem / 1.17rem + bold' }, { hAlign: 'center', content: '' }, { hAlign: 'center', content: '1.5rem / 1.17rem + bold' }, { hAlign: 'center', content: '' }, ]) return table }