承接 theunwindfront/tailwindcss-contrast-checker 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

theunwindfront/tailwindcss-contrast-checker

Composer 安装命令:

composer require theunwindfront/tailwindcss-contrast-checker

包简介

A build-time CLI tool to catch accessibility (a11y) violations by checking Tailwind CSS text and background color combinations for WCAG contrast ratios.

README 文档

README

Latest Version on Packagist Total Downloads NPM Version NPM Downloads License

A fast, lightweight CLI tool that scans your codebase for accessibility (a11y) violations by checking Tailwind CSS text and background color combinations against WCAG 2.1 contrast standards.

The Problem

Accessibility (a11y) is often treated as an afterthought in rapid UI development. Developers frequently combine text and background utility classes (like bg-gray-300 text-white) that fail WCAG contrast ratios, making the application illegible for visually impaired users. Catching these issues manually or relying on browser extensions is slow and error-prone.

The Solution

This CLI tool scans your HTML, Vue, React, Svelte, or Blade templates, extracts the Tailwind utility classes, and mathematically calculates the relative luminance of overlapping background and text color pairs. It warns you in the terminal before you ship to production.

# Example output in terminal
src/components/Button.jsx
  Line 12: FAIL [ Aa ] bg-gray-300 + text-white -> Contrast Ratio: 1.6:1 (Needs 4.5:1 for AA)

Installation

Install the package via Composer (for Laravel integration) and NPM:

composer require theunwindfront/tailwindcss-contrast-checker
npm install -D @theunwindfront/tailwindcss-contrast-checker

Usage Guide

You can run the checker manually or add it to your CI/CD pipeline or build scripts.

npx tailwind-contrast "resources/views/**/*.blade.php"

Adding to package.json

"scripts": {
  "lint:a11y": "tailwind-contrast \"src/**/*.{html,js,jsx,ts,tsx,vue}\""
}

Features

  • 🚀 Framework Agnostic: Scans HTML, JS, JSX, TS, TSX, Vue, Svelte, and Blade files.
  • 🎨 Smart Defaults: Supports standard Tailwind CSS v3 and v4 default colors.
  • 📐 Arbitrary Values: Supports arbitrary hex color values (e.g., bg-[#ff0000]).
  • High Performance: Powered by fast-glob for rapid codebase scanning.

👥 Credits

🤝 Support

For questions or issues, contact pansuriya.sagar94@gmail.com

📄 License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固