SkillAgentSearch skills...

Kroma

A collection of color helpers for SwiftUI.

Install / Use

/learn @kaishin/Kroma
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Kroma 🟥🟩🟦

Test GitHub release Swift 6 platforms

A collection of color extensions and utilities for SwiftUI.

Install

Swift Package Manager (Standalone)

Add Kroma as a dependency in your Package.swift file:

dependencies: [
  ...
 .package(url: "https://github.com/kaishin/Kroma.git", from: "0.2.0")
]

Swift Package Manager (Xcode)

Add https://github.com/kaishin/Kroma.git as a dependency in the Swift Packages tab of the Xcode project.

Usage

Initialize from Hex String

Color(hex: "#FF5733")
Color(hex: "FF5733")   // # is optional
Color(hex: "F00")      // 3-digit shorthand
Color(hex: "FF573380") // 8-digit with alpha

Inspect Color Components

Color.purple.rgbComponents
// -> (0.68, 0.32, 0.87)

Convert to Other Representations

Color.purple.rgbComponents.toHSB()
// -> (0.77, 0.63, 0.87)

Lighten or Darken a Color

<img src="https://github.com/kaishin/Kroma/raw/main/lighter-darker.png?raw=true" alt="Logo" width="200">
Color.purple.rgbComponents // (0.686, 0.322, 0.871)
Color.purple.lighter(by: 0.1).rgbComponents // (0.786, 0.422, 0.971)
Color.purple.darker(by: 0.1).rgbComponents // (0.586, 0.222, 0.771)

Get Luma Value of a Color

Color.purple.luma // 0.438744325864315

You can read more on luma here.

Check if a Color is Perceived as Light or Dark

Color.purple.isLight // false
Color.white.isLight // true
Color.yellow.isLight // true
Color.red.isLight // false

License

See LICENSE.

View on GitHub
GitHub Stars26
CategoryDevelopment
Updated10d ago
Forks8

Languages

Swift

Security Score

75/100

Audited on Mar 26, 2026

No findings