Skip to content

Commit

Permalink
add: Color+Extension (TeamNADA#364)
Browse files Browse the repository at this point in the history
- Color 를 확장하여서 위젯의 다크모드를 대응.
  • Loading branch information
hyun99999 committed Feb 4, 2023
1 parent e5ab3f5 commit 7b55b55
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Widgets/Resource/Extension/Color+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,28 @@
// Created by kimhyungyu on 2023/02/04.
//

import Foundation
import SwiftUI

extension Color {
static func backgroundColor(for colorScheme: ColorScheme) -> Color {
switch colorScheme {
case .light:
return Color(red: 255.0 / 255.0, green: 255.0 / 255.0, blue: 255.0 / 255.0)
case .dark:
return Color(red: 19.0 / 255.0, green: 20.0 / 255.0, blue: 22.0 / 255.0, opacity: 0.5)
@unknown default:
return Color(red: 255.0 / 255.0, green: 255.0 / 255.0, blue: 255.0 / 255.0)
}
}

static func userNameColor(for colorScheme: ColorScheme) -> Color {
switch colorScheme {
case .light:
return Color(red: 19.0 / 255.0, green: 20.0 / 255.0, blue: 22.0 / 255.0)
case .dark:
return Color(red: 255.0 / 255.0, green: 255.0 / 255.0, blue: 255.0 / 255.0)
@unknown default:
return Color(red: 19.0 / 255.0, green: 20.0 / 255.0, blue: 22.0 / 255.0)
}
}
}

0 comments on commit 7b55b55

Please sign in to comment.