audit-swiftui-appearance-color

Audits macOS SwiftUI code for appearance and color defects against current APIs.

2|1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-appearance-color-yigitkonur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-swiftui-appearance-color
Source: https://github.com/yigitkonur/plugin-swiftui/tree/main/plugins/swiftui/skills/audit-swiftui-appearance-color
Command: npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-appearance-color-yigitkonur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ast-grep, and includes scripts (resource) and references (resource) components.

What problem does it solve? AI-generated and hand-written SwiftUI code often contains appearance and color defects: hardcoded RGB literals that break Dark Mode, deprecated modifiers like .foregroundColor and .accentColor (deprecated at macOS 26.5), opaque Color fills where a Material belongs, forced app-wide color schemes, and invented cross-platform APIs like .textColor or UIColor. This Skill systematically detects, verifies, and where safe fixes these defects in a macOS SwiftUI project. ## Core Features & Use Cases - Eight-rule defect index (ac-01 to ac-08): Detects hardcoded Color(red:green:blue:) literals, Color.white/.black misuse, deprecated .foregroundColor/.accentColor, forced .preferredColorScheme, missing Increase Contrast handling, opaque chrome fills, and invented color APIs. - Hybrid lint engine: Runs tier-1 grep tells plus a tier-2 ast-grep structural rule that catches multi-line Color(red:green:blue:) initializers, emitting unified JSON and SARIF reports with a CI-friendly exit code on hard-fail findings. - Corpus-grounded verification: Confirms uncertain findings against a catalog of 1,857 shipping macOS apps via the swiftui-ctx CLI and Apple documentation fetched through Sosumi, then auto-fixes the two mechanical deprecations under a fix-safety protocol. - Use Case: Point the Skill at a SwiftUI macOS project before release; it locates every literal color and deprecated modifier, writes structured findings to swiftui-audits/appearance-color/, and rewrites .foregroundColor(x) to .foregroundStyle(x) with one commit per fix. ## Quick Start Audit the SwiftUI sources in my macOS project for appearance and color problems and fix the deprecated color modifiers.

Frequently Asked Questions about audit-swiftui-appearance-color

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find hardcoded colors in a SwiftUI macOS project?

Run the shared lint runner with this skill's ruleset; it combines grep tells with an ast-grep structural rule that catches even multi-line Color(red:green:blue:) initializers. Each hit must then be read in full to confirm it is a content fill rather than an intentional brand color.

How to replace deprecated foregroundColor and accentColor in SwiftUI?

Replace .foregroundColor(x) with .foregroundStyle(x) and .accentColor(x) with .tint(x); both are deprecated at macOS 26.5. These are identical-argument mechanical renames, so the Skill applies them automatically under its fix-safety protocol with one commit per finding.

Does this audit work on iOS or cross-platform SwiftUI code?

No, the audit is macOS-only and SwiftUI-only, grounded in the macOS 26 SDK and a corpus of shipping macOS apps. Cross-platform APIs like UIColor are flagged as hard-fail invented-API findings rather than audited.

Why does the lint runner report parse warnings on some files?

A parse warning means the file did not fully parse, so a structural ast-grep rule could have missed a defect that grep alone cannot confirm. Those files must be read by hand so a structural miss cannot masquerade as a clean result.

When should a Material be used instead of a Color background?

Use a Material such as .regularMaterial for chrome surfaces over content like sidebars, overlays, and popovers, where an opaque Color flattens depth and freezes one appearance. Content surfaces like cards or charts legitimately keep solid Color fills, so this finding is advisory and read-gated.