diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift index 074fa0a..e6edcc2 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/FMImageEditorViewController.swift @@ -351,8 +351,8 @@ public class FMImageEditorViewController: UIViewController { } private func openFiltersMenu() { - filterMenuButton.tintColor = kRedColor - filterMenuButton.setTitleColor(kRedColor, for: .normal) + filterMenuButton.tintColor = kThemeColor + filterMenuButton.setTitleColor(kThemeColor, for: .normal) cropMenuButton.tintColor = kBlackColor cropMenuButton.setTitleColor(kBlackColor, for: .normal) @@ -369,8 +369,8 @@ public class FMImageEditorViewController: UIViewController { } private func openCropsMenu() { - cropMenuButton.tintColor = kRedColor - cropMenuButton.setTitleColor(kRedColor, for: .normal) + cropMenuButton.tintColor = kThemeColor + cropMenuButton.setTitleColor(kThemeColor, for: .normal) filterMenuButton.tintColor = kBlackColor filterMenuButton.setTitleColor(kBlackColor, for: .normal) diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/Crop/FMCropCropBoxCornersView.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/Crop/FMCropCropBoxCornersView.swift index 5012bac..f1481a4 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/Crop/FMCropCropBoxCornersView.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/Crop/FMCropCropBoxCornersView.swift @@ -76,17 +76,17 @@ class FMCropCropBoxCornersView: UIView { borderView.layer.borderWidth = borderWidth borderView.layer.borderColor = UIColor.white.cgColor - topLeftView.backgroundColor = kRedColor - topRightView.backgroundColor = kRedColor + topLeftView.backgroundColor = kThemeColor + topRightView.backgroundColor = kThemeColor - rightTopView.backgroundColor = kRedColor - rightBottomView.backgroundColor = kRedColor + rightTopView.backgroundColor = kThemeColor + rightBottomView.backgroundColor = kThemeColor - bottomRightView.backgroundColor = kRedColor - bottomLeftView.backgroundColor = kRedColor + bottomRightView.backgroundColor = kThemeColor + bottomLeftView.backgroundColor = kThemeColor - leftBottomView.backgroundColor = kRedColor - leftTopView.backgroundColor = kRedColor + leftBottomView.backgroundColor = kThemeColor + leftTopView.backgroundColor = kThemeColor addSubview(borderView) diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropCell.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropCell.swift index 0e0b064..408694a 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropCell.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMCropCell.swift @@ -41,9 +41,9 @@ class FMCropCell: UICollectionViewCell { public func setSelected() { let tintedImage = imageView.image?.withRenderingMode(.alwaysTemplate) imageView.image = tintedImage - imageView.tintColor = kRedColor + imageView.tintColor = kThemeColor - name.textColor = kRedColor + name.textColor = kThemeColor } public func setDeselected() { diff --git a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFilterCell.swift b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFilterCell.swift index 3638714..c314b4f 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFilterCell.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Scene/Presenter/Editor/Views/FMFilterCell.swift @@ -30,7 +30,7 @@ class FMFilterCell: UICollectionViewCell { selectCircleView.frame = imageView.frame.insetBy(dx: -3, dy: -3) selectCircleView.layer.cornerRadius = selectCircleView.frame.width / 2 selectCircleView.layer.borderWidth = 2 - selectCircleView.layer.borderColor = kRedColor.cgColor + selectCircleView.layer.borderColor = kThemeColor.cgColor // hide selectCircleView by default selectCircleView.isHidden = true @@ -54,7 +54,7 @@ class FMFilterCell: UICollectionViewCell { public func setSelected() { selectCircleView.isHidden = false - name.textColor = kRedColor + name.textColor = kThemeColor } public func setDeselected() { diff --git a/FMPhotoPicker/FMPhotoPicker/source/Utilities/Const.swift b/FMPhotoPicker/FMPhotoPicker/source/Utilities/Const.swift index e8b1f8c..c966951 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Utilities/Const.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Utilities/Const.swift @@ -17,12 +17,14 @@ internal let kRedColor = UIColor(red: 1, green: 81/255, blue: 81/255, alpha: 1) internal let kGrayColor = UIColor(red: 114/255, green: 114/255, blue: 114/255, alpha: 1) internal let kBlackColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1) internal let kBackgroundColor = UIColor(red: 242/255, green: 242/255, blue: 242/255, alpha: 1) +public var kThemeColor: UIColor = kRedColor internal let kTransparentBackgroundColor = UIColor(white: 1, alpha: 0.9) internal let kBorderColor = UIColor(red: 221/255, green: 221/255, blue: 221/255, alpha: 1) internal let kDefaultFilter = FMFilter.None internal let kDefaultCrop = FMCrop.ratioCustom + internal let kEpsilon: CGFloat = 0.01 internal let kFilterPreviewImageSize = CGSize(width: 90, height: 90) diff --git a/FMPhotoPicker/FMPhotoPicker/source/Utilities/FMPhotoPickerConfig.swift b/FMPhotoPicker/FMPhotoPicker/source/Utilities/FMPhotoPickerConfig.swift index 3306e1e..ea7ac34 100644 --- a/FMPhotoPicker/FMPhotoPicker/source/Utilities/FMPhotoPickerConfig.swift +++ b/FMPhotoPicker/FMPhotoPicker/source/Utilities/FMPhotoPickerConfig.swift @@ -8,6 +8,7 @@ import Foundation import Photos +import UIKit public enum FMSelectMode { case multiple @@ -51,6 +52,11 @@ public struct FMPhotoPickerConfig { public var availableCrops: [FMCroppable]? = kDefaultAvailableCrops public var useCropFirst: Bool = false public var alertController: FMAlertable = FMAlert() + public var themeColor: UIColor = kRedColor { + didSet { + kThemeColor = themeColor + } + } /// Whether you want FMPhotoPicker returns PHAsset instead of UIImage. public var shouldReturnAsset: Bool = false @@ -91,6 +97,6 @@ public struct FMPhotoPickerConfig { ] public init() { - + } } diff --git a/FMPhotoPickerExample/FMPhotoPickerExample/ViewController.swift b/FMPhotoPickerExample/FMPhotoPickerExample/ViewController.swift index 6477334..fb5fc8c 100644 --- a/FMPhotoPickerExample/FMPhotoPickerExample/ViewController.swift +++ b/FMPhotoPickerExample/FMPhotoPickerExample/ViewController.swift @@ -89,6 +89,7 @@ class ViewController: UIViewController, FMPhotoPickerViewControllerDelegate, FMI config.maxVideo = self.maxVideo config.forceCropEnabled = forceCropEnabled.isOn config.eclipsePreviewEnabled = eclipsePreviewEnabled.isOn + config.themeColor = .purple // in force crop mode, only the first crop option is available config.availableCrops = [