diff --git a/iBox/Sources/Base/BaseBottomSheetViewController.swift b/iBox/Sources/Base/BaseBottomSheetViewController.swift index 85661cf..ff14c1c 100644 --- a/iBox/Sources/Base/BaseBottomSheetViewController.swift +++ b/iBox/Sources/Base/BaseBottomSheetViewController.swift @@ -104,7 +104,7 @@ class BaseBottomSheetViewController: UIViewController { $0.height.equalTo(bottomSheetHeight) } UIView.animate(withDuration: 0.25, delay: 0, options: .curveEaseIn, animations: { - self.dimmedView.backgroundColor = ColorPalette.dimmedViewColor + self.dimmedView.backgroundColor = .dimmedViewColor self.view.layoutIfNeeded() }) } diff --git a/iBox/Sources/Base/BaseNavigationBarViewController.swift b/iBox/Sources/Base/BaseNavigationBarViewController.swift index d7a31f2..39fd7b2 100644 --- a/iBox/Sources/Base/BaseNavigationBarViewController.swift +++ b/iBox/Sources/Base/BaseNavigationBarViewController.swift @@ -51,7 +51,7 @@ class BaseNavigationBarViewController: UIViewController, BaseNav // MARK: - properties - let backgroundColor: UIColor = .systemBackground + let backgroundColor: UIColor = .backgroundColor let tintColor: UIColor = .label let titleFont: UIFont = .systemFont(ofSize: 20, weight: .semibold) @@ -134,7 +134,7 @@ class BaseNavigationBarViewController: UIViewController, BaseNav // MARK: - functions private func configureUI() { - view.backgroundColor = .systemBackground + view.backgroundColor = .backgroundColor view.addSubview(statusBar) view.addSubview(navigationBar) navigationBar.addSubview(navigationBar.backButton) diff --git a/iBox/Sources/Extension/UIColor+Extension.swift b/iBox/Sources/Extension/UIColor+Extension.swift index 76986cf..e7dce41 100644 --- a/iBox/Sources/Extension/UIColor+Extension.swift +++ b/iBox/Sources/Extension/UIColor+Extension.swift @@ -18,8 +18,24 @@ extension UIColor { ) } - class var box: UIColor { UIColor(hex: 0xFF7F29) } - class var box2: UIColor { UIColor(hex: 0xFF9548) } - class var box3: UIColor { UIColor(hex: 0xFFDC6E) } + private static func color(light: UIColor, dark: UIColor) -> UIColor { + return UIColor { traitCollection in + switch traitCollection.userInterfaceStyle { + case .dark: + return dark + default: + return light + } + } + } + + static let box = UIColor(hex: 0xFF7F29) + static let box2 = UIColor(hex: 0xFF9548) + static let box3 = UIColor(hex: 0xFFDC6E) + static let tableViewBackgroundColor = color(light: .systemGroupedBackground, dark: .systemGray5) + static let floderGray = color(light: .systemGray3, dark: .systemGray2) + static let webIconColor = color(light: .black, dark: .systemGray) + static let dimmedViewColor = UIColor.black.withAlphaComponent(0.75) + static let backgroundColor = color(light: .white, dark: UIColor(hex: 0x242424)) } diff --git a/iBox/Sources/Presenter/BoxList/AddBookmark/AddBookmarkView.swift b/iBox/Sources/Presenter/BoxList/AddBookmark/AddBookmarkView.swift index 1b9fe77..48baf53 100644 --- a/iBox/Sources/Presenter/BoxList/AddBookmark/AddBookmarkView.swift +++ b/iBox/Sources/Presenter/BoxList/AddBookmark/AddBookmarkView.swift @@ -14,7 +14,7 @@ class AddBookmarkBottomSheetView: BaseView { // MARK: - configure UI override func configureUI() { - backgroundColor = .systemBackground + backgroundColor = .backgroundColor } } diff --git a/iBox/Sources/Presenter/BoxList/BoxListCell.swift b/iBox/Sources/Presenter/BoxList/BoxListCell.swift index d457aac..69b346f 100644 --- a/iBox/Sources/Presenter/BoxList/BoxListCell.swift +++ b/iBox/Sources/Presenter/BoxList/BoxListCell.swift @@ -28,7 +28,7 @@ class BoxListCell: UITableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) - backgroundColor = .systemGroupedBackground + backgroundColor = .tableViewBackgroundColor setupLayout() } diff --git a/iBox/Sources/Presenter/BoxList/BoxListView.swift b/iBox/Sources/Presenter/BoxList/BoxListView.swift index 9a7bddb..f2707f6 100644 --- a/iBox/Sources/Presenter/BoxList/BoxListView.swift +++ b/iBox/Sources/Presenter/BoxList/BoxListView.swift @@ -24,7 +24,7 @@ class BoxListView: BaseView { override init(frame: CGRect) { super.init(frame: frame) - backgroundColor = .systemBackground + backgroundColor = .backgroundColor viewModel = BoxListViewModel() setupLayout() @@ -41,7 +41,7 @@ class BoxListView: BaseView { let view = UIView() view.clipsToBounds = true view.layer.cornerRadius = 20 - view.backgroundColor = .systemGroupedBackground + view.backgroundColor = .tableViewBackgroundColor view.addSubview(tableView) tableView.snp.makeConstraints { make in @@ -115,7 +115,7 @@ extension BoxListView: UITableViewDelegate { make.top.bottom.equalToSuperview() make.leading.trailing.equalToSuperview().inset(15) } - view.backgroundColor = ColorPalette.tableViewBackgroundColor + view.backgroundColor = .clear line.backgroundColor = .tertiaryLabel return view } diff --git a/iBox/Sources/Presenter/BoxList/FolderButton.swift b/iBox/Sources/Presenter/BoxList/FolderButton.swift index e0d3f0f..1f51c70 100644 --- a/iBox/Sources/Presenter/BoxList/FolderButton.swift +++ b/iBox/Sources/Presenter/BoxList/FolderButton.swift @@ -36,7 +36,7 @@ class FolderButton: UIButton { init(isOpen: Bool) { self.isOpen = isOpen super.init(frame: .zero) - backgroundColor = .systemGroupedBackground + backgroundColor = .tableViewBackgroundColor setupLayout() } diff --git a/iBox/Sources/Presenter/Favorite/FavoriteView.swift b/iBox/Sources/Presenter/Favorite/FavoriteView.swift index 3a8380d..aff2ee5 100644 --- a/iBox/Sources/Presenter/Favorite/FavoriteView.swift +++ b/iBox/Sources/Presenter/Favorite/FavoriteView.swift @@ -16,7 +16,7 @@ class FavoriteView: PreloadedWebView { override init(frame: CGRect) { super.init(frame: frame) - backgroundColor = .systemBackground + backgroundColor = .backgroundColor setupLayout() } diff --git a/iBox/Sources/Presenter/MainTabBarController.swift b/iBox/Sources/Presenter/MainTabBarController.swift index 57541e5..5cf8eff 100644 --- a/iBox/Sources/Presenter/MainTabBarController.swift +++ b/iBox/Sources/Presenter/MainTabBarController.swift @@ -11,7 +11,7 @@ class MainTabBarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .systemBackground + view.backgroundColor = .backgroundColor setupTabBar() setupTabBarAppearance() diff --git a/iBox/Sources/Presenter/MainView.swift b/iBox/Sources/Presenter/MainView.swift index 9d37b15..202072b 100644 --- a/iBox/Sources/Presenter/MainView.swift +++ b/iBox/Sources/Presenter/MainView.swift @@ -34,7 +34,7 @@ class MainView: UIView { // MARK: - configure UI func configureUI() { - backgroundColor = .systemBackground + backgroundColor = .backgroundColor addSubview(label) diff --git a/iBox/Sources/Presenter/MyPage/MyPageItemCell.swift b/iBox/Sources/Presenter/MyPage/MyPageItemCell.swift index 1c5cdf6..c3a3c72 100644 --- a/iBox/Sources/Presenter/MyPage/MyPageItemCell.swift +++ b/iBox/Sources/Presenter/MyPage/MyPageItemCell.swift @@ -44,6 +44,7 @@ class MyPageItemCell: UITableViewCell, BaseViewProtocol { // MARK: - BaseViewProtocol func configureUI() { + backgroundColor = .clear addSubview(titleLabel) addSubview(descriptionLabel) addSubview(chevronButton) diff --git a/iBox/Sources/Presenter/MyPage/MyPageView.swift b/iBox/Sources/Presenter/MyPage/MyPageView.swift index a066633..c0f57a7 100644 --- a/iBox/Sources/Presenter/MyPage/MyPageView.swift +++ b/iBox/Sources/Presenter/MyPage/MyPageView.swift @@ -43,6 +43,7 @@ class MyPageView: BaseView { $0.register(MyPageItemCell.self, forCellReuseIdentifier: "MyPageItemCell") $0.separatorStyle = .none $0.sectionHeaderTopPadding = 0 + $0.backgroundColor = .clear } // MARK: - Initializer @@ -156,7 +157,7 @@ extension MyPageView: UITableViewDelegate, UITableViewDataSource { // 섹션 헤더의 View 설정 func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIView() - headerView.backgroundColor = .systemGroupedBackground + headerView.backgroundColor = .backgroundColor return headerView } diff --git a/iBox/Sources/Presenter/MyPage/Theme/ThemeCell.swift b/iBox/Sources/Presenter/MyPage/Theme/ThemeCell.swift index 8d1997a..be0dced 100644 --- a/iBox/Sources/Presenter/MyPage/Theme/ThemeCell.swift +++ b/iBox/Sources/Presenter/MyPage/Theme/ThemeCell.swift @@ -38,6 +38,7 @@ class ThemeCell: UITableViewCell, BaseViewProtocol { // MARK: - BaseViewProtocol func configureUI() { + backgroundColor = .clear addSubview(themeImageView) addSubview(titleLabel) addSubview(selectButton) diff --git a/iBox/Sources/Presenter/MyPage/Theme/ThemeView.swift b/iBox/Sources/Presenter/MyPage/Theme/ThemeView.swift index 0d42e03..2984710 100644 --- a/iBox/Sources/Presenter/MyPage/Theme/ThemeView.swift +++ b/iBox/Sources/Presenter/MyPage/Theme/ThemeView.swift @@ -23,6 +23,7 @@ class ThemeView: BaseView { $0.register(ThemeCell.self, forCellReuseIdentifier: "ThemeCell") $0.separatorStyle = .none $0.sectionHeaderTopPadding = 0 + $0.backgroundColor = .clear } // MARK: - Initializer diff --git a/iBox/Sources/Presenter/Web/PreloadedWebView.swift b/iBox/Sources/Presenter/Web/PreloadedWebView.swift index 202a489..9027c9c 100644 --- a/iBox/Sources/Presenter/Web/PreloadedWebView.swift +++ b/iBox/Sources/Presenter/Web/PreloadedWebView.swift @@ -21,7 +21,7 @@ class PreloadedWebView: BaseView { override init(frame: CGRect) { super.init(frame: frame) - backgroundColor = .systemBackground + backgroundColor = .backgroundColor } required init?(coder: NSCoder) { diff --git a/iBox/Sources/Presenter/Web/PreloadedWebViewController.swift b/iBox/Sources/Presenter/Web/PreloadedWebViewController.swift index c3872a0..d9a83b7 100644 --- a/iBox/Sources/Presenter/Web/PreloadedWebViewController.swift +++ b/iBox/Sources/Presenter/Web/PreloadedWebViewController.swift @@ -12,7 +12,7 @@ class PreloadedWebViewController: BaseNavigationBarViewController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .systemBackground + view.backgroundColor = .backgroundColor navigationItem.largeTitleDisplayMode = .never guard let contentView = contentView as? WebView else { return } diff --git a/iBox/Sources/Utils/ColorName.swift b/iBox/Sources/Utils/ColorName.swift new file mode 100644 index 0000000..592876a --- /dev/null +++ b/iBox/Sources/Utils/ColorName.swift @@ -0,0 +1,31 @@ +// +// ColorName.swift +// iBox +// +// Created by 이지현 on 1/3/24. +// + +import UIKit + +enum ColorName: String { + case gray + case green + case red + case blue + case yellow + + func toUIColor() -> UIColor { + switch self { + case .gray: + return UIColor.systemGray2 + case .green: + return UIColor.systemGreen + case .red: + return UIColor.systemRed + case .blue: + return UIColor.systemBlue + case .yellow: + return UIColor.systemYellow + } + } +} diff --git a/iBox/Sources/Utils/ColorPalette.swift b/iBox/Sources/Utils/ColorPalette.swift deleted file mode 100644 index 433334c..0000000 --- a/iBox/Sources/Utils/ColorPalette.swift +++ /dev/null @@ -1,76 +0,0 @@ -// -// ColorPalette.swift -// iBox -// -// Created by 이지현 on 1/3/24. -// - -import UIKit - -enum ColorName: String { - case gray - case green - case red - case blue - case yellow - - func toUIColor() -> UIColor { - switch self { - case .gray: - return UIColor.systemGray2 - case .green: - return UIColor.systemGreen - case .red: - return UIColor.systemRed - case .blue: - return UIColor.systemBlue - case .yellow: - return UIColor.systemYellow - } - } -} - -struct ColorPalette { - - public static var tableViewBackgroundColor = { - return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in - if UITraitCollection.userInterfaceStyle == .dark { - return .systemGray5 - } else { - return .white - } - } - }() - - public static var folderGray = { - return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in - if UITraitCollection.userInterfaceStyle == .dark { - return .systemGray2 - } else { - return .systemGray3 - } - } - }() - - public static var webIconColor = { - return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in - if UITraitCollection.userInterfaceStyle == .dark { - return .systemGray - } else { - return .black - } - } - }() - - public static var dimmedViewColor = { - return UIColor { (UITraitCollection: UITraitCollection) -> UIColor in - if UITraitCollection.userInterfaceStyle == .dark { - return UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.75) - } else { - return UIColor(red: 0, green: 0, blue: 0, alpha: 0.75) - } - } - }() - -} -