 
 extension UIView {
     
+    struct Threshold {
+        static let alpha: CGFloat = 0.5
+        static let white: CGFloat = 0.8
+        static let black: CGFloat = 0.2
+    }
+    
     /// Color that shows through background of the view. Recursively checks superview if view background is clear.
     var visibleBackgroundColor: UIColor? {
         get {

                    var white: CGFloat = 0.0
                    var alpha: CGFloat = 0.0
                    backgroundColor.getWhite(&white, alpha: &alpha)
                    if alpha > 0.5 {
                        color = backgroundColor
                        break
                    }

        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
    }
