All Projects → edwellbrook → Themeable

edwellbrook / Themeable

Licence: MIT License
Easy, type-safe UI theming in Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Themeable

H5ui
Lightweight, elegant open source mobile UI style library.
Stars: ✭ 44 (+15.79%)
Mutual labels:  uikit, style
standard-packages
List of packages that use `standard`
Stars: ✭ 32 (-15.79%)
Mutual labels:  style
ModMove
Move/Resize windows using modifiers and the mouse
Stars: ✭ 86 (+126.32%)
Mutual labels:  osx
WebPKit
A framework that extends a variety of Cocoa APIs with capabilities for encoding and decoding WebP files for all of Apple's platforms.
Stars: ✭ 29 (-23.68%)
Mutual labels:  uikit
reactors
View components and APIs that work web, mobile and native!
Stars: ✭ 14 (-63.16%)
Mutual labels:  osx
magnum-integration
Integration libraries for the Magnum C++11/C++14 graphics engine
Stars: ✭ 75 (+97.37%)
Mutual labels:  osx
TinderUISamples
[ING] - TinderのようなUIを様々な実装で実現してみる
Stars: ✭ 30 (-21.05%)
Mutual labels:  uikit
UIView-SmoothCorners
An App-Store-safe way to enable smooth continuous corners on UIView that works on iOS 11, 12 and 13.
Stars: ✭ 91 (+139.47%)
Mutual labels:  uikit
laravel-uikit
Laravel 5.5/5.6 frontend preset for UIkit 3
Stars: ✭ 11 (-71.05%)
Mutual labels:  uikit
Format.cmake
💅 Stylize your code! Automatic clang-format and cmake-format targets for CMake.
Stars: ✭ 94 (+147.37%)
Mutual labels:  style
Anchor-Bootstrap-UI-Kit
Anchor is a free Bootstrap UI Kit with flexible, ready to use UI components which will hep you build websites faster.
Stars: ✭ 69 (+81.58%)
Mutual labels:  uikit
dictionary-osx
Access the Mac OSX Dictionary app via the command line
Stars: ✭ 20 (-47.37%)
Mutual labels:  osx
MBPageControl
A highly customizable page control for OS X.
Stars: ✭ 38 (+0%)
Mutual labels:  osx
mkosxinstallusb
Linux shell script that creates USB flash drive booting OS X installer
Stars: ✭ 34 (-10.53%)
Mutual labels:  osx
unity-ui-manager
🎫 A Simple UI Manager for rapid prototyping and ease of collaboration
Stars: ✭ 44 (+15.79%)
Mutual labels:  uikit
TextStory
Happier, more flexible NSTextStorage
Stars: ✭ 60 (+57.89%)
Mutual labels:  uikit
barbar
DEPRECATED — OSX crypto-currency price ticker
Stars: ✭ 55 (+44.74%)
Mutual labels:  osx
blog
Source code for the posts of my blog https://theroadtodelphi.com/
Stars: ✭ 96 (+152.63%)
Mutual labels:  osx
CoTerminalApps
Retro ASCII Puzzles plus SpaceInvaders, Pacman & Frogger arcade games that run WITH SOUND in a terminal on any platform !!
Stars: ✭ 21 (-44.74%)
Mutual labels:  osx
EnhanceDiskUtility
SIMBL plugin for Disk Utility that aims to enable Verify / Repair Permissions support
Stars: ✭ 17 (-55.26%)
Mutual labels:  osx

Themeable

Build Status

Easy, type-safe UI theming in Swift.

This project is still in it's early stages, so any and all feedback is welcome. Have any suggestions for how to make this library better? Please leave an issue :)

Pull requests are always very welcome.

Features

  • Type-safe API
  • Transparent memory management
  • Automatically reuse last used theme
  • Thread safe UI updates
  • Theme Views and Controls without subclassing
  • Extremely flexible (build and load your theme the way that works for you)

Installation

Installing with CocoaPods:

# In your Podfile add the following, then
# save and run `pod install`:
pod 'Themeable'

Example Usage

import UIKit
import Themeable

// Define the theme and its properties to be used throughout your app
struct MyAppTheme: Theme {

    let identifier: String
    let seperatorColor: UIColor
    let lightBackgroundColor: UIColor
    let statusBarStyle: UIStatusBarStyle

    static let light = MyAppTheme(
        identifier: "co.brushedtype.Themeable.light-theme",
        seperatorColor: .lightGray,
        lightBackgroundColor: .white,
        statusBarStyle: .default
    )

    static let dark = MyAppTheme(
        identifier: "co.brushedtype.Themeable.dark-theme",
        seperatorColor: .black,
        lightBackgroundColor: .gray,
        statusBarStyle: .lightContent
    )

    // Expose the available theme variants
    static let variants: [MyAppTheme] = [ .light, .dark ]
    
    // Expose the shared theme manager
    static let manager = ThemeManager<MyAppTheme>(default: .light)

}

// Conform to the `Themeable` protocol and register for updates
class TableViewController: UITableViewController, Themeable {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // register the themeable items once all the view and subviews
        // have been loaded
        MyAppTheme.manager.register(themeable: self)
    }

    // function will be called whenever the theme changes
    func apply(theme: MyAppTheme) {
        self.tableView.separatorColor = theme.seperatorColor
        self.tableView.backgroundColor = theme.lightBackgroundColor
    }

}

License

The MIT License (MIT)

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].