All Projects → draveness → Nightnight

draveness / Nightnight

Licence: mit
Elegant way to integrate night mode to swift projects

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Nightnight

Chromacolorpicker
🎨 An intuitive iOS color picker built in Swift.
Stars: ✭ 434 (-43.71%)
Mutual labels:  cocoapods, carthage, color
Xcode One Dark
Atom One Dark theme for Xcode
Stars: ✭ 273 (-64.59%)
Mutual labels:  cocoapods, carthage, color
Colorizeswift
Terminal string styling for Swift.
Stars: ✭ 253 (-67.19%)
Mutual labels:  cocoapods, carthage, color
Leetheme
优雅的主题管理库- 一行代码完成多样式切换
Stars: ✭ 762 (-1.17%)
Mutual labels:  cocoapods, night-mode, color
Stlocationrequest
Request the Location Services via a 3D 360° flyover MKMapView 🗺
Stars: ✭ 636 (-17.51%)
Mutual labels:  cocoapods, carthage
Defaults
Swifty and modern UserDefaults
Stars: ✭ 734 (-4.8%)
Mutual labels:  cocoapods, carthage
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (-16.86%)
Mutual labels:  cocoapods, carthage
Interactivesidemenu
iOS Interactive Side Menu written in Swift.
Stars: ✭ 668 (-13.36%)
Mutual labels:  cocoapods, carthage
Pdfgenerator
A simple generator of PDF written in Swift.
Stars: ✭ 629 (-18.42%)
Mutual labels:  cocoapods, carthage
Flexiblepagecontrol
A flexible UIPageControl like Instagram.
Stars: ✭ 638 (-17.25%)
Mutual labels:  cocoapods, carthage
Gradients
🌔 A curated collection of splendid 180+ gradients made in swift
Stars: ✭ 719 (-6.74%)
Mutual labels:  cocoapods, carthage
Shiny
Iridescent Effect View (inspired by Apple Pay Cash) ✨
Stars: ✭ 707 (-8.3%)
Mutual labels:  cocoapods, carthage
Urlembeddedview
URLEmbeddedView automatically caches the object that is confirmed the Open Graph Protocol.
Stars: ✭ 633 (-17.9%)
Mutual labels:  cocoapods, carthage
Validatedpropertykit
Easily validate your Properties with Property Wrappers 👮
Stars: ✭ 701 (-9.08%)
Mutual labels:  cocoapods, carthage
Kydrawercontroller
Side Drawer Navigation Controller similar to Android
Stars: ✭ 632 (-18.03%)
Mutual labels:  cocoapods, carthage
Flyoverkit
360° flyover on a MKMapView 🚁
Stars: ✭ 666 (-13.62%)
Mutual labels:  cocoapods, carthage
Koyomi
Simple customizable calendar component in Swift 📆
Stars: ✭ 716 (-7.13%)
Mutual labels:  cocoapods, carthage
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (-13.23%)
Mutual labels:  cocoapods, carthage
Blockhook
Hook Objective-C blocks. A powerful AOP tool.
Stars: ✭ 742 (-3.76%)
Mutual labels:  cocoapods, carthage
Swiftoverlays
SwiftOverlays is a Swift GUI library for displaying various popups and notifications
Stars: ✭ 621 (-19.46%)
Mutual labels:  cocoapods, carthage

Travis Status CocoaPods compatible Carthage compatible Platform

NightNight makes it easy to integrate night mode. It provides multiple APIs which all contain keyword mixed.

If you want to implement night mode in Objective-C project without import swift code. This is the Objective-C version DKNightVersion

let view = UIView()
view.mixedBackgroundColor = MixedColor(normal: 0xffffff, night: 0x000000)

let imageView = UIImageView()
imageView.mixedImage = MixedImage(normal: UIImage(named: "normal"), night: UIImage(named: "night")) 

FeaturesUsageCustomizeDemoInstallationLicense

Features

  • [x] Integrate night mode easily
  • [x] UIColor and UIImage support
  • [x] Support NSAttributedString
  • [x] Better autocompletion
  • [x] Customize with notification

Usage

  • Use MixedColor instead of UIColor

    let view = UIView()
    
    view.mixedBackgroundColor = MixedColor(normal: 0xffffff, night: 0x000000)
    
  • Use MixedImage instead of UIImage

    let imageView = UIImageView()
    
    imageView.mixedImage = MixedImage(normal: normal, night: night)
    
  • Support NSAttributedString

    let attributedString = NSMutableAttributedString(string: "NightNight")
    attributedString.setMixedAttributes(
        [NNForegroundColorAttributeName: MixedColor(normal: 0x000000, night: 0xfafafa)],
        range: NSRange(location: 0, length: 9)
    )
    
    public let NNForegroundColorAttributeName
    public let NNBackgroundColorAttributeName
    public let NNUnderlineColorAttributeName
    
  • NavigationBar barStyle

    let navigationBar = navigationController?.navigationBar
    
    navigationBar.mixedBarStyle = MixedBarStyle(normal: .Default, night: .Black)
    
  • Change current theme to .NORMAL or .NIGHT

    NightNight.theme = .NORMAL
    NightNight.theme = .NIGHT
    

Customize

NightNight will send NightNightThemeChangeNotification. if you wanna some customize features, you can observe it and change what you want in corresponding selector.

public let NightNightThemeChangeNotification

Demo

Installation

Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate NightNight into your Xcode project using Carthage, specify it in your Cartfile:

github "draveness/NightNight"

Cocoapods

CocoaPods is a dependency manager for Cocoa projects.

You can install it with the following command:

$ gem install cocoapods

To integrate NightNight into your Xcode project using CocoaPods, specify it in your Podfile:

use_frameworks!

pod 'NightNight'

Manually

  1. Download and drop NightNight/Classesfolder in your project.
  2. Congratulations!

License

Copyright (c) 2016 Draveness (http://github.com/draveness)

NightNight is available under the MIT license. See the LICENSE file for more info.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].