Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: darekkay/a11y-contrast
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.0
Choose a base ref
...
head repository: darekkay/a11y-contrast
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.2.0
Choose a head ref
  • 7 commits
  • 12 files changed
  • 1 contributor

Commits on Nov 7, 2020

  1. Copy the full SHA
    e392fb4 View commit details

Commits on Nov 12, 2020

  1. Add changelog

    darekkay committed Nov 12, 2020
    Copy the full SHA
    a3053f1 View commit details

Commits on Nov 14, 2020

  1. Ignore invalid colors

    Fixes: #2
    darekkay committed Nov 14, 2020
    Copy the full SHA
    4554c74 View commit details

Commits on Nov 23, 2020

  1. Copy the full SHA
    36fb0ae View commit details
  2. Copy the full SHA
    896d22f View commit details
  3. Copy the full SHA
    7f44929 View commit details
  4. Release 1.2.0

    darekkay committed Nov 23, 2020
    Copy the full SHA
    3714669 View commit details
Showing with 422 additions and 34 deletions.
  1. +50 −0 .github/workflows/ci.yml
  2. +0 −14 .travis.yml
  3. +25 −0 CHANGELOG.md
  4. +1 −1 README.md
  5. +3 −1 examples/all.sh
  6. +8 −0 examples/black-white.json
  7. 0 examples/{tailwind.json → tailwind-v1.json}
  8. +272 −0 examples/tailwind-v2.json
  9. +6 −0 examples/uswds.json
  10. +3 −2 package.json
  11. +8 −7 src/__tests__/index.js
  12. +46 −9 src/index.js
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Continuous Integration

on:
push:
branches:
- master
- main
- develop
pull_request:

jobs:
ci:
runs-on: ubuntu-latest
name: node-${{ matrix.node }}
strategy:
matrix:
node: [ 12, 14 ]
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: yarn install --pure-lockfile --prefer-offline

- name: Lint
run: yarn lint

- name: Test
run: yarn test
if: ${{ success() || failure() }}
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

## [Unreleased]

## [1.2.0] - 2020-11-23

- :rocket: Ignore invalid colors.
- :rocket: Don't calculate unnecessary contrast ratios.
- :rocket: Display the mean contrast ratio of a color palette.
- :hammer: Replace TravisCI with GitHub Actions.

## [1.1.0] - 2020-10-28

- :gem: Update example color palettes.
- :bug: Set correct script permissions.
- :hammer: Enable Travis CI.

## [1.0.0] - 2020-08-30

- :tada: Initial release.

[Unreleased]: https://github.com/darekkay/a11y-contrast/compare/1.2.0...HEAD
[1.2.0]: https://github.com/darekkay/a11y-contrast/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/darekkay/a11y-contrast/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/darekkay/a11y-contrast/releases/tag/1.0.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# A11y Contrast

![npm](https://img.shields.io/npm/v/a11y-contrast?style=flat-square)
[![Travis](https://img.shields.io/travis/com/darekkay/a11y-contrast?style=flat-square)](https://travis-ci.com/darekkay/a11y-contrast)
[![Build](https://img.shields.io/github/workflow/status/darekkay/a11y-contrast/Continuous%20Integration/master?style=flat-square)](https://github.com/darekkay/a11y-contrast/actions)
[![license](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://github.com/darekkay/a11y-contrast/blob/master/LICENSE)

A CLI utility to calculate/verify accessible [magic numbers](https://designsystem.digital.gov/design-tokens/color/overview/#magic-number) for a color palette. Read [my blog post](https://darekkay.com/blog/accessible-color-palette/) for some more information.
4 changes: 3 additions & 1 deletion examples/all.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash

../bin/a11y-contrast.js black-white.json
../bin/a11y-contrast.js ibm-v1.json
../bin/a11y-contrast.js ibm-v2.1.json --min-ratio-3=40 --min-ratio-4.5=50 --min-ratio-7=70
../bin/a11y-contrast.js open-color.json
../bin/a11y-contrast.js tailwind.json
../bin/a11y-contrast.js tailwind-v1.json
../bin/a11y-contrast.js tailwind-v2-proposal.json
../bin/a11y-contrast.js tailwind-v2.json
../bin/a11y-contrast.js uswds.json
8 changes: 8 additions & 0 deletions examples/black-white.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"black": {
"black-100": "#000000"
},
"white": {
"white-0": "#ffffff"
}
}
File renamed without changes.
272 changes: 272 additions & 0 deletions examples/tailwind-v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
{
"black": {
"black-100": "#000000"
},
"white": {
"white-0": "#ffffff"
},
"rose": {
"rose-10": "#fff1f2",
"rose-20": "#ffe4e6",
"rose-30": "#fecdd3",
"rose-40": "#fda4af",
"rose-50": "#fb7185",
"rose-60": "#f43f5e",
"rose-70": "#e11d48",
"rose-80": "#be123c",
"rose-90": "#9f1239",
"rose-100": "#881337"
},
"pink": {
"pink-10": "#fdf2f8",
"pink-20": "#fce7f3",
"pink-30": "#fbcfe8",
"pink-40": "#f9a8d4",
"pink-50": "#f472b6",
"pink-60": "#ec4899",
"pink-70": "#db2777",
"pink-80": "#be185d",
"pink-90": "#9d174d",
"pink-100": "#831843"
},
"fuchsia": {
"fuchsia-10": "#fdf4ff",
"fuchsia-20": "#fae8ff",
"fuchsia-30": "#f5d0fe",
"fuchsia-40": "#f0abfc",
"fuchsia-50": "#e879f9",
"fuchsia-60": "#d946ef",
"fuchsia-70": "#c026d3",
"fuchsia-80": "#a21caf",
"fuchsia-90": "#86198f",
"fuchsia-100": "#701a75"
},
"purple": {
"purple-10": "#faf5ff",
"purple-20": "#f3e8ff",
"purple-30": "#e9d5ff",
"purple-40": "#d8b4fe",
"purple-50": "#c084fc",
"purple-60": "#a855f7",
"purple-70": "#9333ea",
"purple-80": "#7e22ce",
"purple-90": "#6b21a8",
"purple-100": "#581c87"
},
"violet": {
"violet-10": "#f5f3ff",
"violet-20": "#ede9fe",
"violet-30": "#ddd6fe",
"violet-40": "#c4b5fd",
"violet-50": "#a78bfa",
"violet-60": "#8b5cf6",
"violet-70": "#7c3aed",
"violet-80": "#6d28d9",
"violet-90": "#5b21b6",
"violet-100": "#4c1d95"
},
"indigo": {
"indigo-10": "#eef2ff",
"indigo-20": "#e0e7ff",
"indigo-30": "#c7d2fe",
"indigo-40": "#a5b4fc",
"indigo-50": "#818cf8",
"indigo-60": "#6366f1",
"indigo-70": "#4f46e5",
"indigo-80": "#4338ca",
"indigo-90": "#3730a3",
"indigo-100": "#312e81"
},
"blue": {
"blue-10": "#eff6ff",
"blue-20": "#dbeafe",
"blue-30": "#bfdbfe",
"blue-40": "#93c5fd",
"blue-50": "#60a5fa",
"blue-60": "#3b82f6",
"blue-70": "#2563eb",
"blue-80": "#1d4ed8",
"blue-90": "#1e40af",
"blue-100": "#1e3a8a"
},
"lightBlue": {
"lightBlue-10": "#f0f9ff",
"lightBlue-20": "#e0f2fe",
"lightBlue-30": "#bae6fd",
"lightBlue-40": "#7dd3fc",
"lightBlue-50": "#38bdf8",
"lightBlue-60": "#0ea5e9",
"lightBlue-70": "#0284c7",
"lightBlue-80": "#0369a1",
"lightBlue-90": "#075985",
"lightBlue-100": "#0c4a6e"
},
"cyan": {
"cyan-10": "#ecfeff",
"cyan-20": "#cffafe",
"cyan-30": "#a5f3fc",
"cyan-40": "#67e8f9",
"cyan-50": "#22d3ee",
"cyan-60": "#06b6d4",
"cyan-70": "#0891b2",
"cyan-80": "#0e7490",
"cyan-90": "#155e75",
"cyan-100": "#164e63"
},
"teal": {
"teal-10": "#f0fdfa",
"teal-20": "#ccfbf1",
"teal-30": "#99f6e4",
"teal-40": "#5eead4",
"teal-50": "#2dd4bf",
"teal-60": "#14b8a6",
"teal-70": "#0d9488",
"teal-80": "#0f766e",
"teal-90": "#115e59",
"teal-100": "#134e4a"
},
"emerald": {
"emerald-10": "#ecfdf5",
"emerald-20": "#d1fae5",
"emerald-30": "#a7f3d0",
"emerald-40": "#6ee7b7",
"emerald-50": "#34d399",
"emerald-60": "#10b981",
"emerald-70": "#059669",
"emerald-80": "#047857",
"emerald-90": "#065f46",
"emerald-100": "#064e3b"
},
"green": {
"green-10": "#f0fdf4",
"green-20": "#dcfce7",
"green-30": "#bbf7d0",
"green-40": "#86efac",
"green-50": "#4ade80",
"green-60": "#22c55e",
"green-70": "#16a34a",
"green-80": "#15803d",
"green-90": "#166534",
"green-100": "#14532d"
},
"lime": {
"lime-10": "#f7fee7",
"lime-20": "#ecfccb",
"lime-30": "#d9f99d",
"lime-40": "#bef264",
"lime-50": "#a3e635",
"lime-60": "#84cc16",
"lime-70": "#65a30d",
"lime-80": "#4d7c0f",
"lime-90": "#3f6212",
"lime-100": "#365314"
},
"yellow": {
"yellow-10": "#fefce8",
"yellow-20": "#fef9c3",
"yellow-30": "#fef08a",
"yellow-40": "#fde047",
"yellow-50": "#facc15",
"yellow-60": "#eab308",
"yellow-70": "#ca8a04",
"yellow-80": "#a16207",
"yellow-90": "#854d0e",
"yellow-100": "#713f12"
},
"amber": {
"amber-10": "#fffbeb",
"amber-20": "#fef3c7",
"amber-30": "#fde68a",
"amber-40": "#fcd34d",
"amber-50": "#fbbf24",
"amber-60": "#f59e0b",
"amber-70": "#d97706",
"amber-80": "#b45309",
"amber-90": "#92400e",
"amber-100": "#78350f"
},
"orange": {
"orange-10": "#fff7ed",
"orange-20": "#ffedd5",
"orange-30": "#fed7aa",
"orange-40": "#fdba74",
"orange-50": "#fb923c",
"orange-60": "#f97316",
"orange-70": "#ea580c",
"orange-80": "#c2410c",
"orange-90": "#9a3412",
"orange-100": "#7c2d12"
},
"red": {
"red-10": "#fef2f2",
"red-20": "#fee2e2",
"red-30": "#fecaca",
"red-40": "#fca5a5",
"red-50": "#f87171",
"red-60": "#ef4444",
"red-70": "#dc2626",
"red-80": "#b91c1c",
"red-90": "#991b1b",
"red-100": "#7f1d1d"
},
"warmGray": {
"warmGray-10": "#fafaf9",
"warmGray-20": "#f5f5f4",
"warmGray-30": "#e7e5e4",
"warmGray-40": "#d6d3d1",
"warmGray-50": "#a8a29e",
"warmGray-60": "#78716c",
"warmGray-70": "#57534e",
"warmGray-80": "#44403c",
"warmGray-90": "#292524",
"warmGray-100": "#1c1917"
},
"trueGray": {
"trueGray-10": "#fafafa",
"trueGray-20": "#f5f5f5",
"trueGray-30": "#e5e5e5",
"trueGray-40": "#d4d4d4",
"trueGray-50": "#a3a3a3",
"trueGray-60": "#737373",
"trueGray-70": "#525252",
"trueGray-80": "#404040",
"trueGray-90": "#262626",
"trueGray-100": "#171717"
},
"gray": {
"gray-10": "#fafafa",
"gray-20": "#f4f4f5",
"gray-30": "#e4e4e7",
"gray-40": "#d4d4d8",
"gray-50": "#a1a1aa",
"gray-60": "#71717a",
"gray-70": "#52525b",
"gray-80": "#3f3f46",
"gray-90": "#27272a",
"gray-100": "#18181b"
},
"coolGray": {
"coolGray-10": "#f9fafb",
"coolGray-20": "#f3f4f6",
"coolGray-30": "#e5e7eb",
"coolGray-40": "#d1d5db",
"coolGray-50": "#9ca3af",
"coolGray-60": "#6b7280",
"coolGray-70": "#4b5563",
"coolGray-80": "#374151",
"coolGray-90": "#1f2937",
"coolGray-100": "#111827"
},
"blueGray": {
"blueGray-10": "#f8fafc",
"blueGray-20": "#f1f5f9",
"blueGray-30": "#e2e8f0",
"blueGray-40": "#cbd5e1",
"blueGray-50": "#94a3b8",
"blueGray-60": "#64748b",
"blueGray-70": "#475569",
"blueGray-80": "#334155",
"blueGray-90": "#1e293b",
"blueGray-100": "#0f172a"
}
}
Loading