From 81014cecde0d0bf2b8d4ec2619b4492e3a5d98d8 Mon Sep 17 00:00:00 2001 From: noeyiz Date: Thu, 22 Feb 2024 16:35:47 +0900 Subject: [PATCH 1/3] =?UTF-8?q?style:=20=EB=8B=A4=ED=81=AC=20=EB=AA=A8?= =?UTF-8?q?=EB=93=9C=20=EC=83=89=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/BaseBottomSheetViewController.swift | 2 +- .../BaseNavigationBarViewController.swift | 4 +- .../Sources/Extension/UIColor+Extension.swift | 22 +++++- .../BoxList/AddBookmark/AddBookmarkView.swift | 2 +- .../Presenter/BoxList/BoxListView.swift | 4 +- .../Presenter/Favorite/FavoriteView.swift | 2 +- .../Presenter/MainTabBarController.swift | 4 +- iBox/Sources/Presenter/MainView.swift | 2 +- .../Presenter/MyPage/MyPageItemCell.swift | 1 + .../Sources/Presenter/MyPage/MyPageView.swift | 1 + .../Presenter/MyPage/Theme/ThemeCell.swift | 1 + .../Presenter/MyPage/Theme/ThemeView.swift | 1 + .../Presenter/Web/PreloadedWebView.swift | 2 +- .../Web/PreloadedWebViewController.swift | 2 +- iBox/Sources/Presenter/Web/WebView.swift | 2 +- .../Presenter/Web/WebViewController.swift | 2 +- iBox/Sources/Utils/ColorName.swift | 31 ++++++++ iBox/Sources/Utils/ColorPalette.swift | 76 ------------------- 18 files changed, 68 insertions(+), 93 deletions(-) create mode 100644 iBox/Sources/Utils/ColorName.swift delete mode 100644 iBox/Sources/Utils/ColorPalette.swift 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..88f8f7c 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: .white, 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/BoxListView.swift b/iBox/Sources/Presenter/BoxList/BoxListView.swift index 9a7bddb..8de4ceb 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() @@ -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/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 7ffd765..9663e27 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() @@ -24,7 +24,7 @@ class MainTabBarController: UITabBarController { setupViewController(viewController: MyPageViewController(), image: UIImage(systemName: "person.fill")) ] tabBar.tintColor = .box - tabBar.backgroundColor = .systemBackground + tabBar.backgroundColor = .backgroundColor } private func setupViewController(viewController: UIViewController, image: UIImage?) -> UIViewController { 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 ee07b29..34e8ee6 100644 --- a/iBox/Sources/Presenter/MyPage/MyPageView.swift +++ b/iBox/Sources/Presenter/MyPage/MyPageView.swift @@ -41,6 +41,7 @@ class MyPageView: BaseView { $0.register(MyPageItemCell.self, forCellReuseIdentifier: "MyPageItemCell") $0.separatorStyle = .none $0.sectionHeaderTopPadding = 0 + $0.backgroundColor = .clear } // MARK: - Initializer 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) - } - } - }() - -} - From b4e6be625aa1247e483108e9595313f94ff2d6b1 Mon Sep 17 00:00:00 2001 From: noeyiz Date: Sat, 24 Feb 2024 04:30:53 +0900 Subject: [PATCH 2/3] =?UTF-8?q?style:=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EC=84=B9=EC=85=98=20=EC=83=89=EC=83=81=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iBox/Sources/Presenter/MyPage/MyPageView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iBox/Sources/Presenter/MyPage/MyPageView.swift b/iBox/Sources/Presenter/MyPage/MyPageView.swift index 34e8ee6..477c8f3 100644 --- a/iBox/Sources/Presenter/MyPage/MyPageView.swift +++ b/iBox/Sources/Presenter/MyPage/MyPageView.swift @@ -147,7 +147,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 } From bdf83730f011212f364a2dd0a57c0bc62190faf2 Mon Sep 17 00:00:00 2001 From: noeyiz Date: Thu, 29 Feb 2024 15:37:27 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20tableViewBackgroundColor=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iBox/Sources/Extension/UIColor+Extension.swift | 2 +- iBox/Sources/Presenter/BoxList/BoxListCell.swift | 2 +- iBox/Sources/Presenter/BoxList/BoxListView.swift | 2 +- iBox/Sources/Presenter/BoxList/FolderButton.swift | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/iBox/Sources/Extension/UIColor+Extension.swift b/iBox/Sources/Extension/UIColor+Extension.swift index 88f8f7c..e7dce41 100644 --- a/iBox/Sources/Extension/UIColor+Extension.swift +++ b/iBox/Sources/Extension/UIColor+Extension.swift @@ -32,7 +32,7 @@ extension UIColor { static let box = UIColor(hex: 0xFF7F29) static let box2 = UIColor(hex: 0xFF9548) static let box3 = UIColor(hex: 0xFFDC6E) - static let tableViewBackgroundColor = color(light: .white, dark: .systemGray5) + 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) 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 8de4ceb..f2707f6 100644 --- a/iBox/Sources/Presenter/BoxList/BoxListView.swift +++ b/iBox/Sources/Presenter/BoxList/BoxListView.swift @@ -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 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() }