Giter Club home page Giter Club logo

nightnight's Introduction

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

  • Integrate night mode easily
  • UIColor and UIImage support
  • Support NSAttributedString
  • Better autocompletion
  • 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.

nightnight's People

Contributors

draveness avatar lfarah avatar

Watchers

James Cloos avatar Vladimirs Matusevics avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.