Go to file
Will L c5cbc21e61
Update README (#11)
2022-11-02 10:51:30 -04:00
.github/workflows Establish GitHub Actions CI (#1) 2022-10-26 11:08:07 -04:00
Sources/CoreColor Refine DocC documentation (#8) 2022-10-27 23:03:49 -04:00
Tests/CoreColorTests Incorporate additional unit tests (#9) 2022-10-27 23:24:47 -04:00
.gitignore Introduce `CoreColor` swift package 2022-10-26 10:57:52 -04:00
.spi.yml Incorporate .spi.yml (#10) 2022-10-28 09:02:10 -04:00
LICENSE Initial commit 2022-10-25 18:47:32 -04:00
Package.swift Introduce `CoreColor` swift package 2022-10-26 10:57:52 -04:00
README.md Update README (#11) 2022-11-02 10:51:30 -04:00

README.md

Color modeling and conversion framework in Swift

CoreColor

Build and Test Swift Version Compatibility Documentation

Overview

CoreColor is a color modeling and conversion framework written in Swift. It is designed for a wide range of audience, including color enthusiasts, engineers, visual designers and artists, as well as those involved in scientific researches that rely on color modeling.

CoreColor provides the modeling for a variety of common color models and associated color spaces, including common ones such as RGB, CMYK, HSL, HSV, LAB, and XYZ, as well as facilities for converting between a particular color model to any of the other ones.

Usage

The interfaces of CoreColor are simple and intuitive to use. Here's an example of creating an instance of RGB color model in sRGB color space, and convert it to the equivalent CMYK model.

import CoreColor

let rgb = RGB(r: 0.40, g: 0.50, b: 0.60, alpha: 1.0, space: RGBColorSpaces.sRGB)
print(rgb) // RGB(r: 0.4, g: 0.5, b: 0.6, alpha: 1.0, space: CoreColor.RGBColorSpace(...))

let cmyk = rgb.toCMYK()
print(cmyk) // CMYK(c: 0.3333334, m: 0.1666667, y: 0.0, k: 0.39999998, alpha: 1.0)

Details

Color Models

The following color models are currently supported:

  • RGB (various RGB color spaces)
  • XYZ (CIE XYZ)
  • LUV (CIE 1976 L*u*v*)
  • LAB (CIE 1976 L*a*b*)
  • CMYK
  • HSV
  • HSL

RGB Color Space

The following variations of RGB color spaces are currently supported:

  • sRGB
  • Linear sRGB
  • Adobe RGB
  • Display P3

Precision and Accuracy

CoreColor was designed to be sufficiently precise in its color modeling, as well as accurate in all color space conversions.

All color model representations are based on 32-bit floating-point values. This achieves sufficient precision and accuracy for the intended audience.

There is plan to extend the precision to beyond 32-bit floating points, as well as using integer representations for select color models in the future.

Documentation

Refer to the official DocC documentation here.

License

CoreColor is licensed under the MIT License.

Credits

CoreColor is a project of @yukonblue.