Skip to content

Swift implementation of Tanner Helland's color-temperature-to-RGB algorithm.

License

Notifications You must be signed in to change notification settings

davidf2281/ColorTempToRGB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorTempToRGB

Swift implementation of Tanner Helland's color-temperature-to-RGB algorithm.

You'll find the algorithm and new initializers for UIKit's UIColor and SwiftUI's Color in Extensions.swift. You can instantiate a color simply by passing in the desired color temperature in Kelvin.

Usage

For UIKit:

let warmWhiteColor = UIColor(temperature: 2700)

For SwiftUI:

let warmWhiteColor = Color(temperature: 2700)

If you're only using one of the extensions you'll probably want to move componentsForColorTemperature(temperature:) into the one you're using and mark it private.

About

Swift implementation of Tanner Helland's color-temperature-to-RGB algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages