@@ -54,6 +54,10 @@ public class ViewerController: UIViewController {
5454 */
5555 public var autoplayVideos : Bool = false
5656
57+ /**
58+ Viewable background color
59+ */
60+ public var viewableBackgroundColor : UIColor = . black
5761 /**
5862 Cache for the reused ViewableControllers
5963 */
@@ -87,7 +91,7 @@ public class ViewerController: UIViewController {
8791 /**
8892 Keeps track of where the status bar should be light or not
8993 */
90- fileprivate var shouldUseLightStatusBar = true
94+ public var shouldUseLightStatusBar = true
9195
9296 /**
9397 Critical button visibility state tracker, it's used to force the buttons to keep being hidden when they are toggled
@@ -106,7 +110,7 @@ public class ViewerController: UIViewController {
106110
107111 fileprivate lazy var overlayView : UIView = {
108112 let view = UIView ( frame: UIScreen . main. bounds)
109- view. backgroundColor = . black
113+ view. backgroundColor = self . viewableBackgroundColor
110114 view. alpha = 0
111115 view. autoresizingMask = [ . flexibleWidth, . flexibleHeight]
112116
@@ -322,7 +326,7 @@ extension ViewerController {
322326 }
323327
324328 viewableController. update ( with: viewable, at: indexPath)
325-
329+ viewableController . viewableBackgroundColor = self . viewableBackgroundColor
326330 return viewableController
327331 }
328332
@@ -500,7 +504,7 @@ extension ViewerController {
500504 @objc func panAction( _ gesture: UIPanGestureRecognizer ) {
501505 let controller = self . findOrCreateViewableController ( self . currentIndexPath)
502506 guard !controller. hasZoomed else { return }
503-
507+
504508 let viewHeight = controller. imageView. frame. size. height
505509 let viewHalfHeight = viewHeight / 2
506510 var translatedPoint = gesture. translation ( in: controller. imageView)
@@ -524,7 +528,7 @@ extension ViewerController {
524528
525529 controller. dimControls ( alpha)
526530 controller. imageView. center = translatedPoint
527- controller. view. backgroundColor = UIColor . black . withAlphaComponent ( alpha)
531+ controller. view. backgroundColor = self . viewableBackgroundColor . withAlphaComponent ( alpha)
528532
529533 if self . buttonsAreVisible {
530534 self . fadeButtons ( alpha)
@@ -539,22 +543,21 @@ extension ViewerController {
539543 self . isDragging = false
540544 UIView . animate ( withDuration: 0.20 , animations: {
541545 controller. imageView. center = self . originalDraggedCenter
542- controller. view. backgroundColor = . black
546+ controller. view. backgroundColor = self . viewableBackgroundColor
543547 controller. dimControls ( 1.0 )
544548
545549 if self . buttonsAreVisible {
546550 self . fadeButtons ( 1 )
547551 }
548552
549553 self . shouldHideStatusBar = !self . buttonsAreVisible
550- self . shouldUseLightStatusBar = true
551554
552555 #if os(iOS)
553556 self . setNeedsStatusBarAppearanceUpdate ( )
554557 #endif
555558 } , completion: { _ in
556559 controller. display ( )
557- self . view. backgroundColor = . black
560+ self . view. backgroundColor = self . viewableBackgroundColor
558561 } )
559562 }
560563 }
0 commit comments