{"id":26601051,"url":"https://github.com/jakemarsh/costumekit","last_synced_at":"2025-04-09T15:09:16.051Z","repository":{"id":141998681,"uuid":"69538022","full_name":"jakemarsh/CostumeKit","owner":"jakemarsh","description":"Base types for theming an app.","archived":false,"fork":false,"pushed_at":"2023-08-08T20:12:23.000Z","size":31,"stargazers_count":297,"open_issues_count":1,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T15:09:12.500Z","etag":null,"topics":["carthage","colors","fonts","images","ios","ios-lib","protocol","svg","swift","themes"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jakemarsh.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}},"created_at":"2016-09-29T06:32:57.000Z","updated_at":"2025-01-17T15:01:49.000Z","dependencies_parsed_at":"2024-01-02T20:53:53.654Z","dependency_job_id":"c59ecd24-29c9-4f3c-9d2c-3b7c9b38c836","html_url":"https://github.com/jakemarsh/CostumeKit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakemarsh%2FCostumeKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakemarsh%2FCostumeKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakemarsh%2FCostumeKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jakemarsh%2FCostumeKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jakemarsh","download_url":"https://codeload.github.com/jakemarsh/CostumeKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248055282,"owners_count":21040157,"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":["carthage","colors","fonts","images","ios","ios-lib","protocol","svg","swift","themes"],"created_at":"2025-03-23T18:36:36.202Z","updated_at":"2025-04-09T15:09:16.028Z","avatar_url":"https://github.com/jakemarsh.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CostumeKit :tophat:\n\n\u003e Base types for theming an app.\n\n**CostumeKit** is made of up a set of Swift protocols. They are meant to be implemented by you in your app.\n\nFeatured in [_Little Bites of Cocoa Bite #270: Implementing Theming with CostumeKit_](https://littlebitesofcocoa.com/270-implementing-theming-with-costumekit)\n\n## Color :art:\n\nIncludes `Color` and `ColorPalette` protocols.\n\nUsage:\n\n``` swift\npublic enum MyAppColors : Color, ColorPalette {\n  case white = \"FFFFFF\"\n  case lightTeal = \"3CB39E\"\n  case forestGreen = \"216055\"\n  case black = \"000000\"\n}\n```\n\n## Font :capital_abcd:\n\nIncludes `Font` protocol, and one concrete `SystemFont` implementation for **iOS** system fonts.\n\nUsage:\n\n``` swift\npublic struct MyAppFont : Font {\n  public init(size: FontSize = .textStyle(.body)) {\n    self.size = size\n  }\n\n  // Font\n\n  public var size: FontSize\n\n  // FontConvertible\n\n  public var FontValue: UIFont {\n    return UIFont(name: \"SomeCustomFont\", size: pointSize)!\n  }\n}\n```\n\n## SVG :stars:\n\nIncludes `SVG` Protocol and `SVGMetadata` type.\n\nUsage:\n\n``` swift\nenum MyAppSVGs {\n  case clockGlyph\n  case bird\n}\n\nextension MyAppSVGs : SVG {\n  public func metadata() -\u003e SVGMetadata {\n    switch self {\n      case .clockGlyph: return SVGMetadata(name: \"clock\", size: CGSize(width: 100, height: 100), fullColor: false)\n      case .bird: return SVGMetadata(name: \"bird\", size: CGSize(width: 58, height: 28), fullColor: true)\n    }\n  }\n}\n```\n\nWhat you do with `SVGMetadata` is up to you. I recommend [SwiftSVG](https://github.com/mchoe/SwiftSVG) from [Michael Choe](https://github.com/mchoe). [Read  more here to learn how to use it](https://www.littlebitesofcocoa.com/198-parsing-rendering-svgs-with-swiftsvg).\n\n**CostumeKit**'s goals are to be a generic solution, so no assumptions are made about how something should be retrieved from disk, parsed, etc. You'll need to implement these anyways, so nothing is forced on you.\n\n## Costume :tophat:\n\nIncludes `Costume` protocol. Usage:\n\n``` swift\nopen class MyAppCostume : Costume {\n  let spacing = CGFloat(8)\n\n  public func wearRootBackground(_ view: UIView) {\n    view.backgroundColor = Color.black.colorValue\n  }\n\n  public func wearHeadline(_ label: UILabel) {\n    label.font = MyAppFont(size: .textStyle(.title1)).fontValue\n    label.textColor = MyAppColors.forestGreen.colorValue\n  }\n\n  public var name: String { return \"Default\" }\n  public var description: String { return \"The default costume.\" }\n\n  public init() { }\n}\n```\n\nCheers.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakemarsh%2Fcostumekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjakemarsh%2Fcostumekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjakemarsh%2Fcostumekit/lists"}