{"id":17289875,"url":"https://github.com/1024jp/wfcolorcode","last_synced_at":"2025-04-14T11:24:02.283Z","repository":{"id":20324773,"uuid":"23599055","full_name":"1024jp/WFColorCode","owner":"1024jp","description":"NSColor extension adding ability to handle HSL color space and CSS3 style color codes","archived":false,"fork":false,"pushed_at":"2024-10-20T13:08:36.000Z","size":196,"stargazers_count":30,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T01:06:39.142Z","etag":null,"topics":["cocoa","nscolor","swift"],"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/1024jp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["1024jp"]}},"created_at":"2014-09-02T23:20:03.000Z","updated_at":"2025-03-13T16:26:14.000Z","dependencies_parsed_at":"2024-01-09T13:50:27.279Z","dependency_job_id":"83f8eeda-e4b3-45f9-a7e3-e933be4b820e","html_url":"https://github.com/1024jp/WFColorCode","commit_stats":{"total_commits":199,"total_committers":2,"mean_commits":99.5,"dds":0.005025125628140725,"last_synced_commit":"a0fc74db98e3814899ed0a8a113564865a76f596"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1024jp%2FWFColorCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1024jp%2FWFColorCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1024jp%2FWFColorCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1024jp%2FWFColorCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1024jp","download_url":"https://codeload.github.com/1024jp/WFColorCode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248869654,"owners_count":21174909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cocoa","nscolor","swift"],"created_at":"2024-10-15T10:36:22.130Z","updated_at":"2025-04-14T11:24:02.252Z","avatar_url":"https://github.com/1024jp.png","language":"Swift","funding_links":["https://github.com/sponsors/1024jp"],"categories":[],"sub_categories":[],"readme":"\nColorCode\n=============================\n\n__ColorCode__ is a set of NSColor extensions that allows creating NSColor/SwiftUI.Color instance from a CSS color code string, or color code string from an NSColor/SwiftUI.Color instance. It also adds the ability to handle HSL color space.\n\n* __Requirements__: macOS 14 or later\n\n\n\nUsage\n-----------------------------\n\nWFColorCode supports the following color code styles.\n\n```swift\n/// color code type\nenum ColorCodeType: Int {\n    case hex          // #ffffff\n    case hexWithAlpha // #ffffffff\n    case shortHex     // #fff\n    case cssRGB       // rgb(255,255,255)\n    case cssRGBa      // rgba(255,255,255,1)\n    case cssHSL       // hsl(0,0%,100%)\n    case cssHSLa      // hsla(0,0%,100%,1)\n    case cssKeyword   // White\n};\n```\n\n### Example\n\nImport `ColorCode` to use.\n\n```swift\nimport ColorCode\n\n// create NSColor instance from HSLa color code\nvar type: ColorCodeType?\nlet whiteColor = NSColor(colorCode: \"hsla(0,0%,100%,0.5)\", type: \u0026type)\nlet hex: String = whiteColor.colorCode(type: .hex)  // =\u003e \"#ffffff\"\n\n// create NSColor instance from HSLa values\nlet color = NSColor(deviceHue:0.1, saturation:0.2, lightness:0.3, alpha:1.0)\n\n// create NSColor instance from a CSS3 keyword\nlet ivoryColor = NSColor(colorCode: \"ivory\")\n\n// get HSL values from NSColor instance\nvar hue: CGFloat = 0\nvar saturation: CGFloat = 0\nvar lightness: CGFloat = 0\nvar alpha: CGFloat = 0\ncolor.getHue(hue: \u0026hue, saturation: \u0026saturation, lightness: \u0026lightness, alpha: \u0026alpha)\n```\n\n\n\nLicense\n-----------------------------\n\n© 2014-2024 1024jp.\n\nThe source code is distributed under the terms of the __MIT License__. See the bundled [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1024jp%2Fwfcolorcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1024jp%2Fwfcolorcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1024jp%2Fwfcolorcode/lists"}