@toolbox-ts/colors
A composable color manipulation library written in TypeScript. Includes type-safe color conversion, contrast evaluation and adjustment, and full WCAG 2.2 compliance utilities with binary search-based lightness tuning.
Installation
npm i @toolbox-ts/colors
Features
- 🎨 Color Conversion: RGB, HSL, HEX interchange with alpha blending
- ♻️ Composable, Flexible & Type-Safe: Fully typed API for parsing,transforming, and analyzing color
- 🚥 WCAG 2.2 Compliance: Testing & Adjustment
- 🧠 Smart Foreground Optimization: via Binary Search
- 🧪 100% Test Coverage: Reliable and robust
Modules Overview
Module | Description | API & Details |
---|---|---|
API | Unified, type-safe API for parsing, converting, blending, adjusting, and analyzing colors. | API README |
Hex | Type-safe utilities for working with hexadecimal color values. | Hex README |
Rgb | Type-safe utilities for RGB and RGBA color objects, including blending and inversion. | Rgb README |
Hsl | Utilities for HSL/HSLA color objects, normalization, and adjustment. | Hsl README |
ColorWheel | Utilities for color wheel math and hue sector logic. | ColorWheel README |
Luminance | Relative luminance, gamma correction, and sRGB/WCAG compliance. | Luminance README |
Contrast | Contrast ratio calculation, WCAG compliance, and color adjustment. | Contrast README |
Converter | Composable, type-safe color conversion between RGB, HEX, and HSL. | Converter README |
License
MIT – © 2025 Nolan Gajdascz