                     color = .darkGray
                     break
                 }
-                if let backgroundColor = superview?.backgroundColor {
+                if let backgroundColor: UIColor = superview?.backgroundColor
+                    ?? (superview as? UINavigationBar)?.barTintColor
+                {
                     var white: CGFloat = 0.0
                     var alpha: CGFloat = 0.0
                     backgroundColor.getWhite(&white, alpha: &alpha)

        var alpha: CGFloat = 0.0
        if let visibleBackgroundColor = visibleBackgroundColor {
            visibleBackgroundColor.getWhite(&white, alpha: &alpha)
            isBackgroundLight = white > Threshold.white ? true : white < Threshold.black ? false : nil
        }
        return isBackgroundLight
    }

    
    struct Threshold {
        static let alpha: CGFloat = 0.5
        static let light: CGFloat = 0.8
        static let dark: CGFloat = 0.6
    }
    
    /// Color that shows through background of the view. Recursively checks superview if view background is clear.
