Garnish
Garnish helps you pick the ideal colors for text and UI elements in light and dark themes, ensuring ideal contrast and visual harmony based on luminance and brightness
Install / Use
/learn @Aeastr/GarnishREADME
| <img src="resources/icons/autoContrast.png" width="64"> | <img src="resources/icons/colorMath.png" width="64"> | <img src="resources/icons/colorAnalysis.png" width="64"> | |:---:|:---:|:---:| | Auto Contrast | Color Math | Color Analysis | | Automatically generate readable text colors from any background | Calculate luminance, brightness, and contrast ratios with WCAG standards | Classify colors as light/dark and validate accessibility compliance |
Overview
- Contrast Optimization - Generate colors that meet WCAG accessibility standards
- Dynamic Color Adaptation - Colors that work beautifully in light and dark themes
- Mathematical Color Analysis - Precise luminance, brightness, and contrast calculations
- Smart Color Generation - Create contrasting shades and optimized color combinations
- Font Weight Optimization - Improved readability through accessibility-first recommendations
Installation
dependencies: [
.package(url: "https://github.com/Aeastr/Garnish.git", from: "1.0.0")
]
See Getting Started for detailed setup instructions.
Usage
import Garnish
// Generate accessible text color for any background
let textColor = Garnish.contrastingColor(.primary, against: backgroundColor) ?? .primary
// Create a contrasting shade of the same color
let shade = Garnish.contrastingShade(of: .blue) ?? .blue
// Check accessibility compliance
let isAccessible = Garnish.hasGoodContrast(foreground, background)
See Documentation for the full API reference.
Playground
Garnish includes a demo app to explore its features. Open the Xcode workspace, select GarnishPlayground, and run.

How It Works
Garnish uses WCAG 2.1 luminance calculations to determine optimal contrast ratios. The core algorithm calculates relative luminance using the sRGB color space formula, then generates contrasting colors that meet accessibility thresholds (4.5:1 for AA, 7:1 for AAA compliance).
Contributing
Contributions welcome. See CONTRIBUTING.md for guidelines.
License
MIT. See LICENSE for details.
Related Skills
node-connect
352.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
