{"id":16686132,"url":"https://github.com/elenionl/easydarkmode","last_synced_at":"2025-03-17T00:33:01.302Z","repository":{"id":52845455,"uuid":"202205127","full_name":"Elenionl/EasyDarkMode","owner":"Elenionl","description":"This is a tool for developers to easily adapt dark mode in iOS 13.","archived":false,"fork":false,"pushed_at":"2021-06-28T10:08:59.000Z","size":1755,"stargazers_count":153,"open_issues_count":2,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T19:32:12.021Z","etag":null,"topics":["dark-mode","dark-theme","darkmode","darkmode-ios13","ios13","objective-c","uitraitcollection"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/Elenionl.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}},"created_at":"2019-08-13T18:44:27.000Z","updated_at":"2024-05-10T01:24:31.000Z","dependencies_parsed_at":"2022-08-21T04:20:34.177Z","dependency_job_id":null,"html_url":"https://github.com/Elenionl/EasyDarkMode","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FEasyDarkMode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FEasyDarkMode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FEasyDarkMode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elenionl%2FEasyDarkMode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Elenionl","download_url":"https://codeload.github.com/Elenionl/EasyDarkMode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221669442,"owners_count":16860879,"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":["dark-mode","dark-theme","darkmode","darkmode-ios13","ios13","objective-c","uitraitcollection"],"created_at":"2024-10-12T15:04:41.080Z","updated_at":"2024-10-27T11:36:19.921Z","avatar_url":"https://github.com/Elenionl.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyDarkMode\n\n![version](https://img.shields.io/cocoapods/v/EasyDarkMode)\n![license](https://img.shields.io/github/license/Elenionl/EasyDarkMode)\n![platform](https://img.shields.io/cocoapods/p/EasyDarkMode)\n![Swfit](https://img.shields.io/badge/Swfit-●-orange)\n![Objective-C](https://img.shields.io/badge/Objective--C-●-blue)\n\n## Introduction\n\niOS 13 introduces user interface feature. This feature contains two kinds of user interface types, light and dark.\n\nThis project is a tool for developers to easily adapt user interface feature in iOS 13.\n\n## **Star** if you like it.\n\n## Samples\n\n![video](https://raw.githubusercontent.com/Elenionl/EasyDarkMode/master/Sample/demo.mov?token=AD5OKW6SDH6NR7ZNXDIYRDK5MKS7U)\n\n![light](https://github.com/Elenionl/EasyDarkMode/blob/master/Sample/image_light.png?raw=true)\n\n![dark](https://github.com/Elenionl/EasyDarkMode/blob/master/Sample/image_dark.png?raw=true)\n\n## Integrate with [Cocoapods](https://cocoapods.org)\n\nUse this firm to find `podfile` script for your project.\n\nFirstly, choose according to the language used in your project (`Swift`/`Objective-C`).\n\nSecondly, choose according to whether you are using network image  (`Local image`/Others).\n\nThen, if you are using network image, choose the download method you preferred (`SDWebImage`/`Kingfisher`/`Custom download method`).\n\n|Podfile script | Objective-C | Swift | Local image | SDWebImage | Kingfisher | Custom download |\n| --- | --- | --- | --- | --- | --- | --- |\n `pod 'EasyDarkMode'` or `pod 'EasyDarkMode/Core'` | ● | ○ | ● | ○ | ○ | ○ |\n| `pod 'EasyDarkMode/Core-Swift'` | ○ | ● | ● | ○ | ○ | ○ |\n| `pod 'EasyDarkMode/SDWebImage'` | ● | ○ | ● | ● | ○ | ○ |\n| `pod 'EasyDarkMode/SDWebImage+Swift'` | ○ | ● | ● | ● | ○ | ○ |\n| `pod 'EasyDarkMode/Kingfisher'` | ○ | ● | ● | ○ | ● | ○ |\n| `pod 'EasyDarkMode/Remote'` | ● | ○ | ● | ○ | ○ | ● |\n| `pod 'EasyDarkMode/Remote-Swift'` | ○ | ● | ● | ○ | ○ | ● |\n\n## How to use\n\n### Create color with different user interface\n\n* Swift\n\nIncluded in pod `'EasyDarkMode/Core-Swift'`\n\n``` Swift\nimport EasyDarkMode\n\nview.backgroundColor = UIColor.dm.color(white:UIColor.black , dark: UIColor.white)\n```\n\n* Objective-C\n\nIncluded in pod `'EasyDarkMode/Core'`\n\n``` Objective-C\n#import \u003cEasyDarkMode/EasyDarkMode.h\u003e\n\nview.backgroundColor = [UIColor dm_colorWithColorLight:UIColor.grayColor dark:UIColor.whiteColor];\n```\n\n### Create image from local with different user interface\n\n* Swift\n\nIncluded in pod `'EasyDarkMode/Core-Swift'`\n\n``` Swift\nimport EasyDarkMode\n\nimageView.image = UIImage.dm.image(name: \"check_light\", dark: \"check_dark\")\n```\n\n* Objective-C\n\nIncluded in pod `'EasyDarkMode/Core'`\n\n``` Objective-C\n#import \u003cEasyDarkMode/EasyDarkMode.h\u003e\n\nimageView.image = [UIImage dm_imageWithNameLight:@\"check_light\" dark:@\"\"check_dark\"\"];\n```\n\n### Create image from SDWebImage with different user interface\n\n* Swift\n\nIncluded in pod `'EasyDarkMode/SDWebImage+Swift'`\n\n``` Swift\nimport EasyDarkMode\n// You should config downloder once before start to download images.\nDMDownloadManager.shared.connectWithSdWebImage()\n// ...\nitem.dm.setImage(pathString: \"http://img.mp.itc.cn/upload/20160525/73e975795bf94f82baf43315f89a30b1_th.jpg\", dark: \"http://img.mp.itc.cn/upload/20160525/5d6588b3c928495a9ee0eb2b0b672936_th.jpg\", for: UIControl.State.normal)\n```\n\n* Objective-C\n\nIncluded in pod `'EasyDarkMode/SDWebImage'`\n\n``` Objective-C\n#import \u003cEasyDarkMode/EasyDrakMode.h\u003e\n// You should config downloder once before start to download images.\n[DMDownloadManager.shared connectWithSdWebImage];\n// ...\n[button dm_setImagePathStringLight:@\"http://img.mp.itc.cn/upload/20160525/73e975795bf94f82baf43315f89a30b1_th.jpg\" dark:@\"http://img.mp.itc.cn/upload/20160525/5d6588b3c928495a9ee0eb2b0b672936_th.jpg\" forState:UIControlStateNnormal];\n```\n\n### Create image from Kingfisher with different user interface\n\n* Swift\n\nIncluded in pod `'EasyDarkMode/Kingfisher'`\n\n``` Swift\nimport EasyDarkMode\n// You should config downloder once before start to download images.\nDMDownloadManager.shared.connectWithKingfisher()\n// ...\nitem.dm.setImage(pathString: \"http://img.mp.itc.cn/upload/20160525/73e975795bf94f82baf43315f89a30b1_th.jpg\", dark: \"http://img.mp.itc.cn/upload/20160525/5d6588b3c928495a9ee0eb2b0b672936_th.jpg\", for: UIControl.State.normal)\n```\n\n### Create image from custom download method with different user interface\n\n* Swift\n\nIncluded in pod `'EasyDarkMode/Remote-Swift'`\n\n``` Swift\nimport EasyDarkMode\n// You should config downloder once before start to download images.\nDMDownloadManager.shared.downloader = { (url, completion) in\n    // ...\n}\n// ...\nitem.dm.setImage(pathString: \"http://img.mp.itc.cn/upload/20160525/73e975795bf94f82baf43315f89a30b1_th.jpg\", dark: \"http://img.mp.itc.cn/upload/20160525/5d6588b3c928495a9ee0eb2b0b672936_th.jpg\", for: UIControl.State.normal)\n```\n\n* Objective-C\n\nIncluded in pod `'EasyDarkMode/Remote'`\n\n``` Objective-C\n#import \u003cEasyDarkMode/EasyDrakMode.h\u003e\n// You should config downloder once before start to download images.\nDMDownloadManager.shared.downloader = ^(NSURL * _Nonnull data, DMDownloadHandler  _Nonnull completion) {\n    // ...\n}\n// ...\n[button dm_setImagePathStringLight:@\"http://img.mp.itc.cn/upload/20160525/73e975795bf94f82baf43315f89a30b1_th.jpg\" dark:@\"http://img.mp.itc.cn/upload/20160525/5d6588b3c928495a9ee0eb2b0b672936_th.jpg\" forState:UIControlStateNnormal];\n```\n\n## Features\n\n* Shortcut method to create UIColor with different user interface type.\n\n* Shortcut method to create UIImage with different user interface type.\n\n* Written in Objective-C. All functions available in Swift with modern APIs.\n\n* Shortcut method to download remoate image with SDWebImage and Kingfisher and create UIImage with different user interface type.\n\n* This code can work on from Xcode 9 to Xcode 11.\n\n* It has an various deployment target version from iOS 8 to iOS 13.\n\n* We found that enable appearence image set in `xcassets` leads to dramatic lagging in application startup. Some walkaround like combine images into one `UIImage` object manually is necessory, if you are working with a giant application.\n\n## TODO\n\n[●] Support UIImage/UIColor\n\n[●] Support SDWebImage\n\n[●] Support KingFisher.\n\n[○] Find a way to support NSTextAttachment in NSAttributedString.\n\n[○] Find a way to support web image for NSTextAttachment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felenionl%2Feasydarkmode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felenionl%2Feasydarkmode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felenionl%2Feasydarkmode/lists"}