🎨 Powerful theme/skin manager for iOS 9+ 主题/换肤, 暗色模式

Overview

SwiftTheme

Introduction - Demos - Installation - Documents - FAQ - Contribution - 中文文档

Screenshot

Running:open SwiftTheme.xcworkspace, run target PlistDemo

Introduction

The Beginning Of The Story

As part of our project requirement, we need to add night mode to our app. It's not as simple as just changing brightness or alpha on the top-level view—in fact, it needs an entirely new interface: different colors, different alpha, different image cuts. More accurately, "night mode" is a theme/skinning feature that can switch between bright theme and dark themes.

So how do we achieve this? Maybe we can set a global variable that represents the currently selected theme, and use different background colors or image cuts based on the variable during the controller's initialization. But then how do we deal with views that have already been initialized? Yes, we could use notifications to change their colors or image cuts, but this leads to controllers unnecessarily full of notification register/unregister, if...else and UI updating code. Worse, if you forget to unregister the notifications, your app may crash.

After some consideration, we put forward higher requirements on the task: create a simple and reusable themes/skinning framework, here as you see.

Goals

Make SwiftTheme a simple, powerful, high-performance, extensible themes/skinning framework. Provide a unified solution for iOS.

Demos

Index Mode

Vary background color of UIView according to the theme setting:

view.theme_backgroundColor = ["#FFF", "#000"]

Vary text color of UILabel and UIButton:

label.theme_textColor = ["#000", "#FFF"]
button.theme_setTitleColor(["#000", "#FFF"], forState: .Normal)

Vary image of UIImageView:

imageView.theme_image = ["day", "night"]

// It's ok by using UIImage instances if you don't want to use image names.
imageView.theme_image = ThemeImagePicker(images: image1, image2)

A miracle happens after you execute the single line of code below!

// these numbers represent the parameters' index. 
// eg. "view.theme_backgroundColor = ["#FFF", "#000"]", index 0 represents "#FFF", index 1 represents "#000"
ThemeManager.setTheme(index: isNight ? 1 : 0)

Get current theme index.

ThemeManager.currentThemeIndex	// Readonly

Index mode is a fast way for the situation: a few themes, but not many, no need to download more new themes.

Notice About Literal:

// Wrong example:
let colors = ["#FFF", "#000"]
view.theme_backgroundColor = colors

// You should write like this:
view.theme_backgroundColor = ["#FFF", "#000"]
// or this:
let colorPickers: ThemeColorPicker = ["#FFF", "#000"]
view.theme_backgroundColor = colorPickers

Because theme_backgroundColor accepts an argument of type ThemeColorPicker,not Array. Nevertheless, "view.theme_backgroundColor = ["#FFF", "#000"]" does the same as initializing an instance of ThemeColorPicker by "Literal" and passing it to the theme_backgroundColor.

Plist/JSON Mode

You may want to make your app download and install an indefinite number of themes. To fulfill this requirement, we provide plist mode. Simply put, you write configuration info such as colors, image cuts and so on, in a plist file. Then, you can use their keys in the logic code. So, the plist file and the resource files are used to constitute a theme package.

Usage demo of plist mode.

view.theme_backgroundColor = "Global.backgroundColor"
imageView.theme_image = "SelectedThemeCell.iconImage"

Similar with the index mode. Only the specific parameters become keys. And as such, we give it the extension ability.

The plist file name is the first paramter of the switching method. In this example, the plist file and other resource files are in the application bundle. It's also ok if they are in sandbox.

ThemeManager.setTheme(plistName: "Red", path: .mainBundle)

plist mode allow you install more themes without modifying logic code. So, you can add the feature that, downloading and installing themes for your app.

the screenshots of the plist and image files we used above:

Objective-C

Fully compatible with Objective-C, usage demo:

lbl.theme_backgroundColor = [ThemeColorPicker pickerWithColors:@[@"#FAF9F9", @"#E2E2E2"]];

Features

  • Written in Swift
  • Fully compatible with Objective-C
  • Based on runtime
  • Simple integration
  • Extension property prefix with "theme_*", friendly with IDE auto-completion
  • Support UIAppearance
  • Index mode, fast integration
  • Plist mode, extend infinite themes
  • Friendly error logs
  • Strongly typed ThemePicker, detect errors during compilling
  • Complete demos

Installation

CocoaPods

pod 'SwiftTheme'
use_frameworks!

Carthage

github "wxxsw/SwiftTheme"

Swift Package Manager

  1. Select Xcode -> File -> Swift Packages -> Add Package Dependency...
  2. Enter https://github.com/wxxsw/SwiftTheme.
  3. Click Next, then select the version, complete.

Source files

Copy all the files in "Sources" folder into your project

Documents

Note: usage of index mode usage of plist mode

Basic Usage


Configure Appearance

SwiftTheme provides new properties for views, they all beigin with theme_. Such as theme_backgroundColor corresponds backgroundColor.

①
view.theme_backgroundColor = ThemeColorPicker(colors: "#FFF", "#000")
view.theme_image = ThemeImagePicker(names: "day", "night")
②
view.theme_backgroundColor = ThemeColorPicker(keyPath: "SomeColorKeyPath")
view.theme_image = ThemeImagePicker(keyPath: "SomeImageKeyPath")

Different type of properties receive different type of Pickers. Thus, IDE will warn you if you pass a wrong parameter.

Switch Themes

When you switch themes, all the theme_ properties you set will update with animation. Usage:

①
ThemeManager.setTheme(index: 0) // ThemePickers will use the first parameter, eg. "#FFF" "day"
ThemeManager.setTheme(index: 1) // ThemePickers will use the second parameter, eg. "#000" "night"
// use "day.plist" in the appllication bundle as the theme configuration file. 
// In this mode, SwiftTheme will find the resource files in the appllication bundle.
ThemeManager.setTheme(plistName: "day", path: .mainBundle)
// use "night.plist" in the sandbox as the theme configuration file, "someURL" is its file path. 
// In this mode, SwiftTheme will find the resource files in the same path.
ThemeManager.setTheme(plistName: "night", path: .sandbox(someURL))
// use a dictionary as the theme configuration, but find resource files in the sandbox.(Not recommend)
ThemeManager.setTheme(dict: dict, path: .sandbox(someURL))

Custom Behaviors

SwiftTheme posts a notification named ThemeUpdateNotification when theme changes, you can observe this notification anywhere and do whatever you want:

NotificationCenter.default.addObserver(
	self, 
	selector: #selector(doSomethingMethod),
	name: NSNotification.Name(rawValue: ThemeUpdateNotification), 
	object: nil
)
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomethingMethod) name:@"ThemeUpdateNotification" object:nil];

Now Supported Properties


Child classes inherit the properties from their super class, such as UILabel have theme_alpha inherited from UIView. These properties will not be list in child classes below.

UIView
  • var theme_alpha: ThemeCGFloatPicker?
  • var theme_backgroundColor: ThemeColorPicker?
  • var theme_tintColor: ThemeColorPicker?
UIApplication
  • func theme_setStatusBarStyle(picker: ThemeStatusBarStylePicker, animated: Bool)
UIBarButtonItem
  • var theme_tintColor: ThemeColorPicker?
UILabel
  • var theme_font: ThemeFontPicker?
  • var theme_textColor: ThemeColorPicker?
  • var theme_textAttributes: ThemeStringAttributesPicker?
  • var theme_highlightedTextColor: ThemeColorPicker?
  • var theme_shadowColor: ThemeColorPicker?
UINavigationBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
  • var theme_titleTextAttributes: ThemeDictionaryPicker?
UITabBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UITableView
  • var theme_separatorColor: ThemeColorPicker?
UITextField
  • var theme_font: ThemeFontPicker?
  • var theme_keyboardAppearance: ThemeKeyboardAppearancePicker?
  • var theme_textColor: ThemeColorPicker?
  • var theme_placeholderAttributes: ThemeDictionaryPicker?
UITextView
  • var theme_font: ThemeFontPicker?
  • var theme_textColor: ThemeColorPicker?
UIToolbar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UISegmentedControl
  • var theme_selectedSegmentTintColor: ThemeColorPicker?
  • func theme_setTitleTextAttributes(_ picker: ThemeStringAttributesPicker?, forState state: UIControl.State)
UISwitch
  • var theme_onTintColor: ThemeColorPicker?
  • var theme_thumbTintColor: ThemeColorPicker?
UISlider
  • var theme_thumbTintColor: ThemeColorPicker?
  • var theme_minimumTrackTintColor: ThemeColorPicker?
  • var theme_maximumTrackTintColor: ThemeColorPicker?
UISearchBar
  • var theme_barStyle: ThemeBarStylePicker?
  • var theme_barTintColor: ThemeColorPicker?
UIProgressView
  • var theme_progressTintColor: ThemeColorPicker?
  • var theme_trackTintColor: ThemeColorPicker?
UIPageControl
  • var theme_pageIndicatorTintColor: ThemeColorPicker?
  • var theme_currentPageIndicatorTintColor: ThemeColorPicker?
UIImageView
  • var theme_image: ThemeImagePicker?
UIActivityIndicatorView
  • var theme_activityIndicatorViewStyle: ThemeActivityIndicatorViewStylePicker?
UIButton
  • func theme_setImage(picker: ThemeImagePicker?, forState state: UIControlState)
  • func theme_setBackgroundImage(picker: ThemeImagePicker?, forState state: UIControlState)
  • func theme_setTitleColor(picker: ThemeColorPicker?, forState state: UIControlState)
  • func theme_setAttributedTitle(picker: ThemeAttributedStringPicker?, forState state: UIControlState)
CALayer
  • var theme_backgroundColor: ThemeCGColorPicker?
  • var theme_borderWidth: ThemeCGFloatPicker?
  • var theme_borderColor: ThemeCGColorPicker?
  • var theme_shadowColor: ThemeCGColorPicker?
CATextLayer
  • var theme_foregroundColor: ThemeCGColorPicker?
CAGradientLayer
  • var theme_colors: ThemeAnyPicker?
UIRefreshControl
  • var theme_titleAttributes: ThemeDictionaryPicker?
UIVisualEffectView
  • var theme_effect: ThemeVisualEffectPicker?

Picker


ThemeColorPicker

// supported formats:
// "#ffcc00"		RGB
// "#ffcc00dd"		RGBA
// "#FFF"			RGB in short
// "#013E"			RGBA in short
ThemeColorPicker(colors: "#FFFFFF", "#000")
ThemeColorPicker(colors: UIColor.red, UIColor.blue)
ThemeColorPicker.pickerWithColors(["#FFFFFF", "#000"])
ThemeColorPicker.pickerWithUIColors([UIColor.red, UIColor.blue])
②
ThemeColorPicker(keyPath: "someStringKeyPath")
ThemeColorPicker.pickerWithKeyPath("someStringKeyPath")

ThemeImagePicker

ThemeImagePicker(names: "image1", "image2")
ThemeImagePicker.pickerWithNames(["image1", "image2"])
ThemeImagePicker(images: UIImage(named: "image1")!, UIImage(named: "image2")!)
ThemeImagePicker.pickerWithImages([UIImage(named: "image1")!, UIImage(named: "image2")!])
②
ThemeImagePicker(keyPath: "someStringKeyPath")
ThemeImagePicker.pickerWithKeyPath("someStringKeyPath")

ThemeCGFloatPicker

ThemeCGFloatPicker(floats: 1.0, 0.7)
ThemeCGFloatPicker.pickerWithFloats([1.0, 0.7])
②
ThemeCGFloatPicker(keyPath: "someNumberKeyPath")
ThemeCGFloatPicker.pickerWithKeyPath("someNumberKeyPath")

ThemeCGColorPicker

ThemeCGColorPicker(colors: "#FFFFFF", "#000")
ThemeCGColorPicker(colors: UIColor.red, UIColor.blue)
ThemeCGColorPicker(colors: UIColor.red.cgColor, UIColor.blue.cgColor)
ThemeCGColorPicker.pickerWithColors(["#FFFFFF", "#000"])
ThemeCGColorPicker.pickerWithUIColors([UIColor.blue, UIColor.red])
②
ThemeCGColorPicker(keyPath: "someStringKeyPath")
ThemeCGColorPicker.pickerWithKeyPath("someStringKeyPath")

ThemeFontPicker

ThemeFontPicker(fonts: UIFont.systemFont(ofSize: 10), UIFont.systemFont(ofSize: 11))
ThemeFontPicker.pickerWithFonts([UIFont.systemFont(ofSize: 10), UIFont.systemFont(ofSize: 11)])
②
// name the key you like, but the available values format like this: "PingFangSC-Regular,16"
ThemeFontPicker(keyPath: "someStringKeyPath")
ThemeFontPicker.pickerWithKeyPath("someStringKeyPath")

ThemeDictionaryPicker

ThemeDictionaryPicker(dicts: ["key": "value"], ["key": "value"])
ThemeDictionaryPicker.pickerWithDicts([["key": "value"], ["key": "value"]])
②
ThemeDictionaryPicker(keyPath: "someStringKeyPath") { (Any?) -> [String: AnyObject]? in ... }

ThemeStringAttributesPicker

ThemeStringAttributesPicker(["key": "value"], ["key": "value"])
ThemeStringAttributesPicker.pickerWithAttributes([NSAttributedStringKey.font: UIFont.systemFont(ofSize: 16)])
②
ThemeStringAttributesPicker(keyPath: "someStringKeyPath") { (Any?) -> [NSAttributedString.Key: Any]? in ... }

ThemeAttributedStringPicker

ThemeAttributedStringPicker(NSAttributedString(...), NSAttributedString(...))
ThemeAttributedStringPicker.pickerWithAttributedStrings([NSAttributedString(...)])
②
ThemeAttributedStringPicker(keyPath: "someStringKeyPath") { (Any?) -> NSAttributedString? in ... }

ThemeBarStylePicker

ThemeBarStylePicker(styles: .default, .black)
ThemeBarStylePicker.pickerWithStyles([.default, .black])
ThemeBarStylePicker.pickerWithStringStyles(["default", "black"])
②
// name the key you like, but the available values are "default" and "black"
ThemeBarStylePicker(keyPath: "someStringKeyPath")
ThemeBarStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeStatusBarStylePicker

ThemeStatusBarStylePicker(styles: .default, .lightContent, .darkContent)
ThemeStatusBarStylePicker.pickerWithStyles([.default, .lightContent, .darkContent])
ThemeStatusBarStylePicker.pickerWithStringStyles(["default", "lightContent", "darkContent"])
②
// name the key you like, but the available values are "default", "lightContent" and "darkContent"
ThemeStatusBarStylePicker(keyPath: "someStringKeyPath")
ThemeStatusBarStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeKeyboardAppearancePicker

ThemeKeyboardAppearancePicker(styles: .default, .dark, .light)
ThemeKeyboardAppearancePicker.pickerWithStyles([.default, .dark, .light])
ThemeKeyboardAppearancePicker.pickerWithStringStyles(["default", "dark", "light"])
②
// name the key you like, but the available values are "default", "dark" and "light"
ThemeKeyboardAppearancePicker(keyPath: "someStringKeyPath")
ThemeKeyboardAppearancePicker.pickerWithKeyPath("someStringKeyPath")

ThemeActivityIndicatorViewStylePicker

ThemeActivityIndicatorViewStylePicker(styles: .whiteLarge, .white, .gray)
ThemeActivityIndicatorViewStylePicker.pickerWithStyles([.whiteLarge, .white, .gray])
ThemeActivityIndicatorViewStylePicker.pickerWithStringStyles(["whiteLarge", "white", "gray"])
②
// name the key you like, but the available values are "whiteLarge", "white" and "gray"
ThemeActivityIndicatorViewStylePicker(keyPath: "someStringKeyPath")
ThemeActivityIndicatorViewStylePicker.pickerWithKeyPath("someStringKeyPath")

ThemeVisualEffectPicker

ThemeVisualEffectPicker(effects: UIBlurEffect(style: .light), UIBlurEffect(style: .dark))
ThemeVisualEffectPicker.pickerWithEffects([UIBlurEffect(style: .light), UIBlurEffect(style: .dark)])
ThemeVisualEffectPicker.pickerWithStringEffects(["light", "dark", "extralight", "prominent", "regular"])
②
// name the key you like, but the available values are "light", "dark", "extralight", "prominent" and "regular"
ThemeVisualEffectPicker(keyPath: "someStringKeyPath")
ThemeVisualEffectPicker.pickerWithKeyPath("someStringKeyPath")

ThemeAnyPicker

ThemeAnyPicker(anys: 0, "123", UIColor.red)
ThemeAnyPicker.pickerWithAnys([0, "123", UIColor.red])
②
ThemeAnyPicker(keyPath: "someStringKeyPath")
ThemeAnyPicker.pickerWithKeyPath("someStringKeyPath")

More

Download this project and find more. There are four demo targets:

  • Demo shows how to use index mode and how to save the last selection of themes and other general usages.
  • PlistDemo shows how to use plist mode and how to download themes that packaged in zip files.
  • JsonDemo is like PlistDemo, but use json.
  • OCDemo is Demo's Objective-C version.
  • TVOSDemo is used to test tvos compatibility.

FAQ

  1. Why doesn't theme_setStatusBarStyle work as expected?

    In your app's Info.plist you will need to set View Controller-based status bar appearence to NO.

  2. Can I manually cancel the theme of a property?

    Sure, just make it nil—example: view.theme_backgroundColor = nil.

Contribution

Issue

If you find a bug or need a help, you can create a issue

Pull Request

We are happy to accept pull requests :D. But please make sure it's needed by most developers and make it simple to use. If you are not sure, create an issue and we can discuss it before you get to coding.

Contributors

Gesen, Zhoujun, Kevin Cramer

Lisence

The MIT License (MIT)

Comments
  • Plist mode can't convert value of type 'String' to 'ThemeStatusbarStylePicker'

    Plist mode can't convert value of type 'String' to 'ThemeStatusbarStylePicker'

    I'm trying to implement plist mode to my app, but I'm getting exceptions that can't convert / assign string to 'ThemeStatusBarStylePicker' / 'ThemeColorPicker'. I have almost did same with your plist demo project, but I think I missed something. Please help me.

    opened by devAstro81 12
  • 如何设置纯透明

    如何设置纯透明

    作者好,

    我有如下场景:

    基类VC中默认设置一个控件的主题色组,两个色值,都是十六进制RGB格式的,有一个继承基类VC的子VC,对于该控件,不论哪个主题,都是要透明的,也就是UIColor.clear;

    我看到readme文件中有RGBA格式传入的方法,就将"#ffffff00", "##ffffff00"传入,但是xcode日志处会输出: SwiftTheme WARNING: Not convert rgba ##ffffff00 in array: ["#ffffff00", "##ffffff00"][1]

    当我xcode直接运行app到手机的时候,主题切换时,显示正常,当关掉app,重新打开的时候,就有机率,显示的还是基类设置的色值组

    另外我这边更加适合直接传入colors给theme_xxx,一般对于color都封装好了hexColor的方法,甚至起了便于识别的颜色名字,在readme中看到可以用类似:UIColor.yellow.cgcolor的形式传入,尝试过,会提示,无法将ThemeCGColorPicker转为ThemeColorPicker

    盼回复,谢谢!

    opened by deepindo 11
  • ThemePicker keypath 方式初始化的一些疑问

    ThemePicker keypath 方式初始化的一些疑问

    看了下代码,发现 ThemeFontPicker 和 ThemeDictionaryPicker 没有以keyPath为参数的初始化方法,ThemeFontPicker 没有比较好好理解,字符串确实不太好表达 Font,ThemeDictionaryPicker 没有就比较奇怪了(plist中是可以表达dictionary的呀),而且 ThemeManager+Plist 中也定义了 dictionaryForKeyPath(_),可能是我还没太理解,希望能够解释以下,谢谢~。

    另外,上述两者如果没有 keypath初始化方法,那么使用的时候就会和其他picker不一致了,其他的picker只要指定 keypath,就可以自动完成根据theme切换属性值的功能,而如果是上述的两个picker的话,恐怕要外界自行根据theme去init?

    opened by cjsliuj 11
  • theme_setStatusBarStyle doesn't work as expected

    theme_setStatusBarStyle doesn't work as expected

    Hi, thanks for your awesome project, it helps me a lot. But I got a problem. theme colour and images works well but the status bar doesn't change respond to ThemeManager.setTheme

    I add code below in my didFinishLaunchingWithOptions

    UIApplication.sharedApplication().theme_setStatusBarStyle(ThemeStatusBarStylePicker(styles: .Default, .LightContent), animated: true)
    

    It doesn't work, anything else I need to do to change my status bar style?

    opened by futantan 7
  • Cocoapods not working

    Cocoapods not working

    I installed the cocoapods and them tried to set the theme (plist mode) in App Delegate using following code :

    ThemeManager.setTheme(plistName: "Red", path: .mainBundle)

    I was not able to get autocomplete predictions, as well as, on building the project, I was getting error on this line

    Please help!!!

    opened by vaibhav-varshaaweblabs 6
  • add ThemeTabBarAppearancePicker + theme_standart/compact/scrollEdgeAppearance

    add ThemeTabBarAppearancePicker + theme_standart/compact/scrollEdgeAppearance

    Required changes for setting appearance at iOS 15 for UITabBar. Here is a trouble, caused be new iOS 15 transparent appearance: https://stackoverflow.com/questions/68688270/ios-15-uitabbarcontrollers-tabbar-background-color-turns-black

    It were not possible to use proposed decisions from stackoverflow while using SwiftTheme. That is why I've decided to implement missing scrollEdgeAppearance behaviour here.

    opened by rusel95 5
  • Change alpha for ighlighting  rows with theme_backgroundColor

    Change alpha for ighlighting rows with theme_backgroundColor

    Hi,

    Thanks for your awesome repo. 👌🏼

    Before using SwiftTheme I set highlight row as follow:

    `override func tableView(_ tableView: UITableView, didHighlightRowAt indexPath: IndexPath) {

            let cell = tableView.cellForRow(at: indexPath)
            
            cell?.contentView.backgroundColor = UIColor(red: 0, green: 169/255, blue: 168/255, alpha: 0.25)
    }`
    

    So as you can see I need alpha = 0.25, alpha just for the backgroundColor not for the contentView.

    Is there a way to set alpha using theme_backgroundColor ??

    cell?.contentView.theme_backgroundColor = ["#00a9a8", "#292b38"]

    Thanks.

    opened by Maryom 5
  • OC 调用Bug

    OC 调用Bug

    下载到Documents里的plist文件,在调用setThemeWithPlistInSandbox方法的时候,会自动在plist文件名参数后拼接一个.plist后缀,导致原本的文件名由xxx.plist变成xxx.plist.plist,然后识别失败。

    SwiftTheme WARNING: Not read plist 'momentsBear_theme.plist' with: /Users/fiber/Library/Developer/CoreSimulator/Devices/1FEF7344-AA28-494C-9B96-B4DF9D6F285F/data/Containers/Data/Application/D9F52344-3E99-42A8-819B-2C471D349709/Documents/Theme/1/theme3x/momentsBear_theme.plist.plist

    opened by vergilw 5
  • Navigation Bar themable title

    Navigation Bar themable title

    I'm trying to set the navigation bar title a themable value, so I have in AppDelegate

            private func setupTheming() {
            let _ = UITextField.appearance().backgroundColor?.toHexString() ?? "000000"
            let attributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.red.toHexString()] as [String: AnyObject]
            UINavigationBar.appearance().theme_barTintColor = [UIColor.blue.toHexString(), UIColor.nightDarkGray.toHexString()]
            UINavigationBar.appearance().theme_tintColor = [UIColor.cream.toHexString(), UIColor.nightOrange.toHexString()]
            UINavigationBar.appearance().theme_titleTextAttributes = ThemeDictionaryPicker.pickerWithDicts([attributes])
    

    So it should be set to red, but nothing happens. If I set the value to a a UILabel.appearance it works

    UILabel.appearance().theme_textColor = [UIColor.blueGray.toHexString(), UIColor.orange.toHexString()]

    Any idea on how to proceed?

    opened by alexbartisro 4
  • tabBar.barStyle and navigationBar.barStyle stopped working with Swift 4

    tabBar.barStyle and navigationBar.barStyle stopped working with Swift 4

    Hello, I recently updated to Swift 4 and noticed that this stopped working:

    let navigationBar = UINavigationBar.appearance()
    navigationBar.theme_barStyle = [.default, .black]
    
    let tabBar = UITabBar.appearance()
    tabBar.theme_barStyle = [.default, .black]
    

    All I see is the default style that doesn't change when switching theme. Tested on both real device and simulator. However setting tabBar.barStyle = .black manually seems to work just fine. Any help?

    bug 
    opened by n3d1117 4
  • Named colors in plist

    Named colors in plist

    Thanks for this wonderful library! I am missing just one feature at the moment and that is to name colors in the plist file so we can reference them via their name within the plist file. This way we can change just the hex value of one named color to change many elements at once. It will be convenient and will lead to less errors.

    Like the color #ECF0F1 in the PlistDemo used in several places https://github.com/jiecao-fm/SwiftTheme/blob/master/PlistDemo/Night.plist

    EDIT: Maybe even shared named colors palette between multiple themes/plists? I am adding a night mode to an app and they both use the same palette.

    opened by martinflorek 4
  • Issues with UILabel and UIView with shadow (Swift)

    Issues with UILabel and UIView with shadow (Swift)

    When the view containing some labels has shadow and the view background color is clear color...the shadow gets applied on the labels inside the view when i enable theme in that specific view. Simulator Screen Shot - iPhone 12 - 2022-03-09 at 15 11 52 Simulator Screen Shot - iPhone 12 - 2022-03-09 at 15 12 04

    opened by jaseelop 0
  • Error compilation via Carthage

    Error compilation via Carthage

    Hi,

    I try with last version of Carthage (0.38.0) (cache clean)... github "wxxsw/SwiftTheme" ~> 0.6.3 : "ThemeTabBarAppearancePicker"

    ld+PlaceholderAttributes.bc -o /Users/robertjuzyna/Library/Caches/org.carthage.CarthageKit/DerivedData/13.1_13A1030d/SwiftTheme/0.6.3/Build/Intermediates.noindex/ArchiveIntermediates/SwiftTheme/IntermediateBuildFilesPath/SwiftTheme.build/Release-iphoneos/SwiftTheme.build/Objects-normal/arm64/ThemeColorPicker.bc
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:134:35: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_standardAppearance: ThemeTabBarAppearancePicker? {
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:139:34: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_compactAppearance: ThemeTabBarAppearancePicker? {
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/robertjuzyna/Dev/Obvious21/client/Common/iOS/Carthage/Checkouts/SwiftTheme/Sources/UIKit+Theme.swift:144:37: error: cannot find type 'ThemeTabBarAppearancePicker' in scope
        var theme_scrollEdgeAppearance: ThemeTabBarAppearancePicker? {
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ** ARCHIVE FAILED **
    
    
    The following build commands failed:
    	CompileSwift normal armv7 (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwiftSources normal armv7 com.apple.xcode.tools.swift.compiler (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwift normal arm64 (in target 'SwiftTheme' from project 'SwiftTheme')
    	CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'SwiftTheme' from project 'SwiftTheme')
    (4 failures)
    
    opened by Droppix 2
  • swift 5,创建一个新控制器,导航栏右边的文字颜色没改变,还有tabbar会跳动,什么原因呢?

    swift 5,创建一个新控制器,导航栏右边的文字颜色没改变,还有tabbar会跳动,什么原因呢?

    https://user-images.githubusercontent.com/81165987/118320502-6514db00-b50d-11eb-9ded-918d818b23c2.mov

    这是APPDelegate代码 image

    image 这是自定义UITabBarController image

    image 这是新控制器代码

    opened by nikeios 0
Owner
Gesen
———————————————
Gesen
👕👚 Theme management in Swift

Themes Story Ever want to support Night mode? Or skin the app differently depending on the seasons? Or toggle features according to paid status? Well,

Khoa 238 Dec 26, 2022
A Publish theme. ckitakishi.com is built with PaletteTheme

PaletteTheme A Publish theme. ckitakishi.com is built with PaletteTheme. Features Simple and fast Mobile friendly Support both Light/Dark mode Customi

Yuhan Chen 10 Nov 29, 2022
This repository contains 🎨 My Xcode theme that I use. It is compatible with all versions of Xcode.

DRL Xcodetheme Installation Automatic (via script) ./install.sh which will install the file in Xcode FontAndColorThemes directory. Restart Xcode Go t

durul dalkanat 19 Oct 21, 2022
Theme handling macOS Appkit (Swift/Objective-C)

DSFAppearanceManager A class for simplifying macOS appearance values and detecting setting changes (Swift/Objective-C). Why? If you're performing cust

Darren Ford 8 Nov 1, 2022
Solarized Dark Theme for Xcode. Compatible with all modern versions of Xcode since 2013!

Solarized Dark for Xcode Note I've moved away from using Solarized to a Night-Shift/Dark-Mode-friendly palette of my own creation; Cognac. It's availa

Arthur Ariel Sabintsev 365 Nov 25, 2022
An ambient light accessibility framework for iOS.

Ambience Brightness aware accessibility theme switching without coding. Special thanks I'd like to thank Meng To and Marcos Griselli and all the Desig

Tiago Mergulhão 454 Sep 14, 2022
Guidelines for iOS development in use at Spotify

Spotify Objective-C Coding Style Version: 0.9.0 Our general coding conventions at Spotify are documented on an internal wiki, but specifics for Object

Spotify 239 Nov 11, 2022
Good ideas for iOS development, by Futurice developers.

iOS Good Practices Just like software, this document will rot unless we take care of it. We encourage everyone to help us on that – just open an issue

Futurice 10.7k Dec 29, 2022
A powerful lightweight theme 🎨 manager for SwiftUI

SwiftTheming ?? is a handy lightweight handy theme manager which handles multiple themes based on system-wide appearances - light and dark appearances

Dscyre Scotti  38 Dec 29, 2022
An implementation of High Pass Skin Smoothing using Apple's Core Image Framework

YUCIHighPassSkinSmoothing An implementation of High Pass Skin Smoothing using CoreImage.framework Available on both OS X and iOS. Ports A MetalPetal b

Yu Ao 1.2k Dec 17, 2022
🦙This repository keeps alive the famous skin of Winamp 5, Big Bento!

Latest Version: 1.2.8 (Changelog) Winamp Big Bento Redux This repository keeps alive the famous skin of Winamp 5, Big Bento by updating some componets

null 5 Aug 21, 2022
A Modern Skin recreating Winamp 1.00.

Winamp 1.00 Modern Skin This is a Modern Skin for Winamp 5.666/WACUP that aims to 100% emulate what Winamp 1.00 looked and felt like back in the day.

Eris Lund 5 Dec 23, 2022
Kushal Shingote 1 Feb 2, 2022
An unintrusive & light-weight iOS app-theming library with support for animated theme switching.

Gestalt Gestalt is an unintrusive and light-weight framework for application theming with support for animated theme switching. Usage Let's say you wa

Vincent Esche 327 Nov 8, 2022
🌸 Powerful Codable API requests builder and manager for iOS.

This lib is about network requests with blackjack, roulette and craps! Using it you will be able to convert your massive API layer code into an awesom

CodyFire 251 Jan 8, 2023
FlexibleImage is implemented with the hope that anyone could easily develop an app that provides features such as Camera Filter and Theme.

FlexibleImage is implemented with the hope that anyone could easily develop an app that provides features such as Camera Filter and Theme. When you wr

Jungwon An 815 Dec 30, 2022
👕👚 Theme management in Swift

Themes Story Ever want to support Night mode? Or skin the app differently depending on the seasons? Or toggle features according to paid status? Well,

Khoa 238 Dec 26, 2022
🧛🏻‍♂️ Dark theme for SwiftUI

Dracula for SwiftUI A dark theme for SwiftUI. Install All instructions can be found at draculatheme.com/swiftui. Team This theme is maintained by the

Dracula Theme 14 Jul 26, 2022
SwiftUI module library for adding seasons theme animations to your app

HolidayThemes SwiftUI module library for adding seasons theme animations to your app. Requirements iOS 13.0+ Xcode 12.0+ Installation Swift Package Ma

null 2 Mar 7, 2022
A very simple soundboard that plays the first 5 seconds of the CSI Miami theme (YEAAAAAAAAAA)

MiamiSunglasses This app is a single-sound soundboard that plays the first few seconds of the CSI Miami theme song when you press the sunglasses. Disc

Adrian Edwards 4 Feb 10, 2022