/Name4RGB

Open Source Library to Find the Nearest Color Name in Swift

Primary LanguageSwiftMIT LicenseMIT

Name4RGB

Open Source Library to Find the Nearest Color Name for Color and UIColor.

Installation

Swift Package Manager

For installation with Swift Package Manager, add the following to Package.swift:

.package(url: "https://github.com/ProjectInTheClass/Name4RGB", from: "0.1.0")

How To Use

Find name of Color

You can easily find find name of Color, localized color names by specifying the language and region.

let color = Color(red: 0.4, green: 0.4, blue: 0.4)
print(color.name())        // dimgray
print(color.name("en-GB")) // dimgrey

let uiColor = UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1.0)
print(uiColor.name())        // dimgray
print(uiColor.name("en-GB")) // dimgrey

License

Distributed under the MIT License. See LICENSE for more information.