Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme values don't affect menu title color #12

Open
1 of 4 tasks
revblaze opened this issue May 7, 2020 · 1 comment
Open
1 of 4 tasks

Theme values don't affect menu title color #12

revblaze opened this issue May 7, 2020 · 1 comment

Comments

@revblaze
Copy link

revblaze commented May 7, 2020

Hi,

First off, huge fan of the project! Best menu option for iOS that I've seen by far.

This may be a me problem, but I've been trying to create a dark theme based on your struct layout in MenuTheme.swift. For whatever reason, the menu title (UILabel) won't respect the set UIColor.

I see that, in MenuView.swift, you have the following setup:

public func applyTheme(_ theme: MenuTheme) {
        self.theme = theme
        
        titleLabel.font = theme.font
        titleLabel.textColor = theme.darkTintColor
        gestureBarView.backgroundColor = theme.gestureBarTint
        tintView.backgroundColor = theme.backgroundTint
        effectView.effect = theme.blurEffect
        
        contents?.applyTheme(theme)
    }
    
    public override func tintColorDidChange() {
        titleLabel.textColor = tintColor
    }
}

The title label should always reflect either theme.darkTintColor (or alternatively, tintColor), correct?

I have the following set for my custom dark theme (in MenuTheme.swift):

public struct DarkMenuTheme: MenuTheme {
    
    public let font = UIFont.systemFont(ofSize: 16, weight: .medium)
    public let textColor = UIColor.white
    public let brightTintColor = UIColor.white
    public let darkTintColor = UIColor.white
    public let highlightedTextColor = UIColor.white
    public let highlightedBackgroundColor = UIColor(red: 0/255.0, green: 122/255.0, blue: 255/255.0, alpha: 1.0)
    public let backgroundTint = UIColor(white: 0.0, alpha: 0.15)
    public let gestureBarTint = UIColor(red: 255/255.0, green: 255/255.0, blue: 255/255.0, alpha: 0.7)
    public let blurEffect = UIBlurEffect(style: .dark)
    public let shadowColor = UIColor.black
    public let shadowOpacity: Float = 0.3
    public let shadowRadius: CGFloat = 7.0
    public let separatorColor = UIColor(white: 1, alpha: 0.1)
    
    public init() {}
}

However, regardless of what I do, the menu title will appear as UIColor.black (or something very similar) – as opposed to the set UIColor.white value. When I select the menu title, it will turn white; however, at rest (non-interaction), it remains dark and I'm unable to change it without changing the core code.

Similarly, do you plan on adding the other three layout options to your project? ie. Menu dropdown to:

  • Down, Right
  • Down, Left
  • Up, Right
  • Up, Left

Thank you again for the project! It added such an elegant beauty to my simple web browser project.

EDIT: Also, are you planning on adding disabled menu options? ie. When a user can't go back in a WKWebView, disabling the "Back" menu option.

EDIT 2: Since SF Symbols were released relatively recently, is there any possibility of adding those as a menu title or adding an SF glyph next to the left of a menu item? Thanks!

@revblaze
Copy link
Author

revblaze commented May 7, 2020

Oops, my apologies. This was a me problem. I had the menu.tintColor value set further down my ViewController.swift that was overriding the set values.

Feel free to close. If you do have an answer to those bottom questions, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant