{"id":18036065,"url":"https://github.com/kjuly/colorcalculation","last_synced_at":"2026-04-30T01:31:44.916Z","repository":{"id":216589938,"uuid":"731971278","full_name":"Kjuly/ColorCalculation","owner":"Kjuly","description":"A color extension library for calculating hex, brightness, etc.","archived":false,"fork":false,"pushed_at":"2024-01-11T08:02:15.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-06T01:47:23.523Z","etag":null,"topics":["calculation","color","color-conversion","ios","macos","spm","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kjuly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-15T10:14:37.000Z","updated_at":"2026-01-10T12:43:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"610d8656-c0f6-403c-a38b-602067ab228b","html_url":"https://github.com/Kjuly/ColorCalculation","commit_stats":null,"previous_names":["kjuly/colorcalculation"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Kjuly/ColorCalculation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FColorCalculation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FColorCalculation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FColorCalculation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FColorCalculation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kjuly","download_url":"https://codeload.github.com/Kjuly/ColorCalculation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kjuly%2FColorCalculation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32451136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculation","color","color-conversion","ios","macos","spm","watchos"],"created_at":"2024-10-30T12:11:26.583Z","updated_at":"2026-04-30T01:31:44.901Z","avatar_url":"https://github.com/Kjuly.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ColorCalculation\nA color extension library for calculating hex, brightness, etc.\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FKjuly%2FColorCalculation%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/Kjuly/ColorCalculation)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2FKjuly%2FColorCalculation%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/Kjuly/ColorCalculation)  \n![macOS][macOS-Badge] ![iOS][iOS-Badge] ![watchOS][watchOS-Badge]  \n[![SPM][SPM-Badge]][SPM-Link] [![CocoaPods][CocoaPods-Badge]][CocoaPods-Link] [![Carthage][Carthage-Badge]][Carthage-Link]\n\n[macOS-Badge]: https://img.shields.io/badge/macOS-12.0%2B-blue?labelColor=00367A\u0026color=3081D0\n[iOS-Badge]: https://img.shields.io/badge/iOS-15.5%2B-blue?labelColor=00367A\u0026color=3081D0\n[watchOS-Badge]: https://img.shields.io/badge/watchOS-6.0%2B-blue?labelColor=00367A\u0026color=3081D0\n\n[SPM-Badge]: https://img.shields.io/github/v/tag/Kjuly/ColorCalculation?label=SPM\u0026labelColor=2F4858\u0026color=A8DF8E\n[SPM-Link]: https://swiftpackageindex.com/Kjuly/ColorCalculation\n[CocoaPods-Badge]: https://img.shields.io/cocoapods/v/ColorCalculation?label=CocoaPods\u0026labelColor=2F4858\u0026color=A8DF8E\n[CocoaPods-Link]: https://cocoapods.org/pods/ColorCalculation\n[Carthage-Badge]: https://img.shields.io/github/v/tag/Kjuly/ColorCalculation?label=Carthage\u0026labelColor=2F4858\u0026color=A8DF8E\n[Carthage-Link]: https://swiftpackageindex.com/Kjuly/ColorCalculation\n\n## Installation\n\nSee the following subsections for details on the different installation methods.\n\n- [Swift Package Manager](INSTALLATION.md#swift-package-manager)\n- [CocoaPods](INSTALLATION.md#cocoaPods)\n- [Carthage](INSTALLATION.md#carthage)\n- [Submodule](INSTALLATION.md#submodule)\n\n## Color Hex Usage\n\nCreate a color from hex value.\n\n```swift\n// Notes: there's an optional `alpha` arg available.\n//   e.g., Color(hex: 0xFFFFFF, alpha: 0.5)\nColor(hex: 0xFFFFFF)\nUIColor(hex: 0xFFFFFF)\nNSColor(hex: 0xFFFFFF)\n```\n\nOr get the hex value from a color.\n\n```swift\ncolor.hex\nuiColor.hex\nnsColor.hex\n```\n\nAn extension to String is also provided to get hex values in Int32.\n\n```swift\n// Below all are valid and returns 0xFFFFFF.\n\"FFFFFF\".toColorHex\n\"#FFFFFF\".toColorHex\n\"0xFFFFFF\".toColorHex\n```\n\n## Color Brightness Usage\n\nGet to know a color is bright or dark. \n\nIt can be used to determine the color of text on the background. If the background color is bright, use black text color, otherwise use white.\n\n```swift\nlet backgroundColor = UIColor(hex: 0xFFFFFF)\nlet foregroundColor: UIColor = (backgroundColor.isBrightColor ? .black : .white) \n// `foregroundColor = .black` in this case\n```\n\n## Color Conversion Usage\n\nConvenient extension for converting colors between Color, UIColor and NSColor.\n\n```swift\ncolor.toUIColor\ncolor.toNSColor\n\nuiColor.toColor\nnsColor.toColor\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjuly%2Fcolorcalculation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjuly%2Fcolorcalculation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjuly%2Fcolorcalculation/lists"}