Refactor damus color references
This commit is contained in:
@@ -8,8 +8,8 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
let RECTANGLE_GRADIENT = LinearGradient(gradient: Gradient(colors: [
|
let RECTANGLE_GRADIENT = LinearGradient(gradient: Gradient(colors: [
|
||||||
Color("DamusPurple"),
|
DamusColors.purple,
|
||||||
Color("DamusBlue")
|
DamusColors.blue
|
||||||
]), startPoint: .leading, endPoint: .trailing)
|
]), startPoint: .leading, endPoint: .trailing)
|
||||||
|
|
||||||
struct CustomPicker<SelectionValue: Hashable, Content: View>: View {
|
struct CustomPicker<SelectionValue: Hashable, Content: View>: View {
|
||||||
@@ -56,6 +56,6 @@ struct CustomPicker<SelectionValue: Hashable, Content: View>: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func textColor() -> Color {
|
func textColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ import Foundation
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
class DamusColors {
|
class DamusColors {
|
||||||
static let adaptableGray = Color("DamusAdaptableGrey")
|
static let adaptableGrey = Color("DamusAdaptableGrey")
|
||||||
static let white = Color("DamusWhite")
|
static let white = Color("DamusWhite")
|
||||||
static let black = Color("DamusBlack")
|
static let black = Color("DamusBlack")
|
||||||
static let lightGray = Color("DamusLightGray")
|
static let lightGrey = Color("DamusLightGrey")
|
||||||
static let mediumGray = Color("DamusMediumGray")
|
static let mediumGrey = Color("DamusMediumGrey")
|
||||||
static let darkGray = Color("DamusDarkGray")
|
static let darkGrey = Color("DamusDarkGray")
|
||||||
static let green = Color("DamusGreen")
|
static let green = Color("DamusGreen")
|
||||||
static let purple = Color("DamusGreen")
|
static let purple = Color("DamusPurple")
|
||||||
|
static let blue = Color("DamusBlue")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ struct InvoiceView: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
} else {
|
} else {
|
||||||
Image(systemName: "checkmark.circle")
|
Image(systemName: "checkmark.circle")
|
||||||
.foregroundColor(Color("DamusGreen"))
|
.foregroundColor(DamusColors.green)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ struct ContentView: View {
|
|||||||
Image("damus-home")
|
Image("damus-home")
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width:30,height:30)
|
.frame(width:30,height:30)
|
||||||
.shadow(color: Color("DamusPurple"), radius: 2)
|
.shadow(color: DamusColors.purple, radius: 2)
|
||||||
.opacity(isSideBarOpened ? 0 : 1)
|
.opacity(isSideBarOpened ? 0 : 1)
|
||||||
.animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
|
.animation(isSideBarOpened ? .none : .default, value: isSideBarOpened)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ struct ShareAction: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
||||||
let col = colorScheme == .light ? Color("DamusMediumGrey") : Color("DamusWhite")
|
let col = colorScheme == .light ? DamusColors.mediumGrey : DamusColors.white
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
Text("Share Note", comment: "Title text to indicate that the buttons below are meant to be used to share a note with others.")
|
Text("Share Note", comment: "Title text to indicate that the buttons below are meant to be used to share a note with others.")
|
||||||
@@ -75,10 +75,10 @@ struct ShareAction: View {
|
|||||||
}) {
|
}) {
|
||||||
Text(NSLocalizedString("Cancel", comment: "Button to cancel a repost."))
|
Text(NSLocalizedString("Cancel", comment: "Button to cancel a repost."))
|
||||||
.frame(minWidth: 300, maxWidth: .infinity, minHeight: 50, maxHeight: 50, alignment: .center)
|
.frame(minWidth: 300, maxWidth: .infinity, minHeight: 50, maxHeight: 50, alignment: .center)
|
||||||
.foregroundColor(colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite"))
|
.foregroundColor(colorScheme == .light ? DamusColors.black : DamusColors.white)
|
||||||
.overlay {
|
.overlay {
|
||||||
RoundedRectangle(cornerRadius: 24)
|
RoundedRectangle(cornerRadius: 24)
|
||||||
.stroke(colorScheme == .light ? Color("DamusMediumGrey") : Color("DamusWhite"), lineWidth: 1)
|
.stroke(colorScheme == .light ? DamusColors.mediumGrey : DamusColors.white, lineWidth: 1)
|
||||||
}
|
}
|
||||||
.padding(EdgeInsets(top: 10, leading: 50, bottom: 25, trailing: 50))
|
.padding(EdgeInsets(top: 10, leading: 50, bottom: 25, trailing: 50))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ struct ConfigView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func textColor() -> Color {
|
func textColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
|
|
||||||
func authenticateLocally(completion: @escaping (Bool) -> Void) {
|
func authenticateLocally(completion: @escaping (Bool) -> Void) {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ struct EditMetadataView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func imageBorderColor() -> Color {
|
func imageBorderColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
|
colorScheme == .light ? DamusColors.white : DamusColors.black
|
||||||
}
|
}
|
||||||
|
|
||||||
func save() {
|
func save() {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ struct MutedEventView: View {
|
|||||||
var MutedBox: some View {
|
var MutedBox: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
RoundedRectangle(cornerRadius: 20)
|
RoundedRectangle(cornerRadius: 20)
|
||||||
.foregroundColor(Color("DamusAdaptableGrey"))
|
.foregroundColor(DamusColors.adaptableGrey)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Text("Post from a user you've blocked", comment: "Text to indicate that what is being shown is a post from a user who has been blocked.")
|
Text("Post from a user you've blocked", comment: "Text to indicate that what is being shown is a post from a user who has been blocked.")
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ struct ZapEvent: View {
|
|||||||
|
|
||||||
if zap.private_request != nil {
|
if zap.private_request != nil {
|
||||||
Image(systemName: "lock.fill")
|
Image(systemName: "lock.fill")
|
||||||
.foregroundColor(Color("DamusGreen"))
|
.foregroundColor(DamusColors.green)
|
||||||
.help(NSLocalizedString("Only you can see this message and who sent it.", comment: "Help text on green lock icon that explains that only the current user can see the message of a zap event and who sent the zap."))
|
.help(NSLocalizedString("Only you can see this message and who sent it.", comment: "Help text on green lock icon that explains that only the current user can see the message of a zap event and who sent the zap."))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,11 +50,11 @@ struct FollowButtonView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func filledTextColor() -> Color {
|
func filledTextColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
|
colorScheme == .light ? DamusColors.white : DamusColors.black
|
||||||
}
|
}
|
||||||
|
|
||||||
func fillColor() -> Color {
|
func fillColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
|
|
||||||
func emptyColor() -> Color {
|
func emptyColor() -> Color {
|
||||||
@@ -62,7 +62,7 @@ struct FollowButtonView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func borderColor() -> Color {
|
func borderColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusDarkGrey") : Color("DamusLightGrey")
|
colorScheme == .light ? DamusColors.darkGrey : DamusColors.lightGrey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,14 +190,14 @@ struct NoteContentView: View {
|
|||||||
func hashtag_str(_ htag: String) -> AttributedString {
|
func hashtag_str(_ htag: String) -> AttributedString {
|
||||||
var attributedString = AttributedString(stringLiteral: "#\(htag)")
|
var attributedString = AttributedString(stringLiteral: "#\(htag)")
|
||||||
attributedString.link = URL(string: "damus:t:\(htag)")
|
attributedString.link = URL(string: "damus:t:\(htag)")
|
||||||
attributedString.foregroundColor = Color("DamusPurple")
|
attributedString.foregroundColor = DamusColors.purple
|
||||||
return attributedString
|
return attributedString
|
||||||
}
|
}
|
||||||
|
|
||||||
func url_str(_ url: URL) -> AttributedString {
|
func url_str(_ url: URL) -> AttributedString {
|
||||||
var attributedString = AttributedString(stringLiteral: url.absoluteString)
|
var attributedString = AttributedString(stringLiteral: url.absoluteString)
|
||||||
attributedString.link = url
|
attributedString.link = url
|
||||||
attributedString.foregroundColor = Color("DamusPurple")
|
attributedString.foregroundColor = DamusColors.purple
|
||||||
return attributedString
|
return attributedString
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,13 +209,13 @@ func mention_str(_ m: Mention, profiles: Profiles) -> AttributedString {
|
|||||||
let disp = Profile.displayName(profile: profile, pubkey: pk).username
|
let disp = Profile.displayName(profile: profile, pubkey: pk).username
|
||||||
var attributedString = AttributedString(stringLiteral: "@\(disp)")
|
var attributedString = AttributedString(stringLiteral: "@\(disp)")
|
||||||
attributedString.link = URL(string: "damus:\(encode_pubkey_uri(m.ref))")
|
attributedString.link = URL(string: "damus:\(encode_pubkey_uri(m.ref))")
|
||||||
attributedString.foregroundColor = Color("DamusPurple")
|
attributedString.foregroundColor = DamusColors.purple
|
||||||
return attributedString
|
return attributedString
|
||||||
case .event:
|
case .event:
|
||||||
let bevid = bech32_note_id(m.ref.ref_id) ?? m.ref.ref_id
|
let bevid = bech32_note_id(m.ref.ref_id) ?? m.ref.ref_id
|
||||||
var attributedString = AttributedString(stringLiteral: "@\(abbrev_pubkey(bevid))")
|
var attributedString = AttributedString(stringLiteral: "@\(abbrev_pubkey(bevid))")
|
||||||
attributedString.link = URL(string: "damus:\(encode_event_id_uri(m.ref))")
|
attributedString.link = URL(string: "damus:\(encode_event_id_uri(m.ref))")
|
||||||
attributedString.foregroundColor = Color("DamusPurple")
|
attributedString.foregroundColor = DamusColors.purple
|
||||||
return attributedString
|
return attributedString
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ struct EventGroupView: View {
|
|||||||
switch group {
|
switch group {
|
||||||
case .repost:
|
case .repost:
|
||||||
Image(systemName: "arrow.2.squarepath")
|
Image(systemName: "arrow.2.squarepath")
|
||||||
.foregroundColor(Color("DamusGreen"))
|
.foregroundColor(DamusColors.green)
|
||||||
case .reaction:
|
case .reaction:
|
||||||
LINEAR_GRADIENT
|
LINEAR_GRADIENT
|
||||||
.mask(Image("shaka-full")
|
.mask(Image("shaka-full")
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import SwiftUI
|
|||||||
|
|
||||||
let BUTTON_SIZE = 57.0
|
let BUTTON_SIZE = 57.0
|
||||||
let LINEAR_GRADIENT = LinearGradient(gradient: Gradient(colors: [
|
let LINEAR_GRADIENT = LinearGradient(gradient: Gradient(colors: [
|
||||||
Color("DamusPurple"),
|
DamusColors.purple,
|
||||||
Color("DamusBlue")
|
DamusColors.blue
|
||||||
]), startPoint: .topTrailing, endPoint: .bottomTrailing)
|
]), startPoint: .topTrailing, endPoint: .bottomTrailing)
|
||||||
|
|
||||||
func PostButton(action: @escaping () -> ()) -> some View {
|
func PostButton(action: @escaping () -> ()) -> some View {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ struct FollowsYou: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
.background {
|
.background {
|
||||||
RoundedRectangle(cornerRadius: 5.0)
|
RoundedRectangle(cornerRadius: 5.0)
|
||||||
.foregroundColor(Color("DamusAdaptableGrey"))
|
.foregroundColor(DamusColors.adaptableGrey)
|
||||||
}
|
}
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,11 +87,11 @@ struct EditButton: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func fillColor() -> Color {
|
func fillColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
|
|
||||||
func borderColor() -> Color {
|
func borderColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ struct ProfileView: View {
|
|||||||
@Environment(\.presentationMode) var presentationMode
|
@Environment(\.presentationMode) var presentationMode
|
||||||
|
|
||||||
func imageBorderColor() -> Color {
|
func imageBorderColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
|
colorScheme == .light ? DamusColors.white : DamusColors.black
|
||||||
}
|
}
|
||||||
|
|
||||||
func bannerBlurViewOpacity() -> Double {
|
func bannerBlurViewOpacity() -> Double {
|
||||||
@@ -236,7 +236,7 @@ struct ProfileView: View {
|
|||||||
}
|
}
|
||||||
.padding(.top, 5)
|
.padding(.top, 5)
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.accentColor(Color("DamusWhite"))
|
.accentColor(DamusColors.white)
|
||||||
}
|
}
|
||||||
|
|
||||||
func lnButton(lnurl: String, profile: Profile) -> some View {
|
func lnButton(lnurl: String, profile: Profile) -> some View {
|
||||||
@@ -493,7 +493,7 @@ struct KeyView: View {
|
|||||||
@State private var isCopied = false
|
@State private var isCopied = false
|
||||||
|
|
||||||
func keyColor() -> Color {
|
func keyColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
|
|
||||||
private func copyPubkey(_ pubkey: String) {
|
private func copyPubkey(_ pubkey: String) {
|
||||||
@@ -530,7 +530,7 @@ struct KeyView: View {
|
|||||||
}
|
}
|
||||||
.padding(2)
|
.padding(2)
|
||||||
.padding([.leading, .trailing], 3)
|
.padding([.leading, .trailing], 3)
|
||||||
.background(RoundedRectangle(cornerRadius: 11).foregroundColor(Color("DamusAdaptableGrey")))
|
.background(RoundedRectangle(cornerRadius: 11).foregroundColor(DamusColors.adaptableGrey))
|
||||||
|
|
||||||
if isCopied != true {
|
if isCopied != true {
|
||||||
Button {
|
Button {
|
||||||
@@ -555,7 +555,7 @@ struct KeyView: View {
|
|||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.layoutPriority(1)
|
.layoutPriority(1)
|
||||||
}
|
}
|
||||||
.foregroundColor(Color("DamusGreen"))
|
.foregroundColor(DamusColors.green)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,23 +42,23 @@ struct QRCodeView: View {
|
|||||||
let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
|
let profile = damus_state.profiles.lookup(id: damus_state.pubkey)
|
||||||
|
|
||||||
if (damus_state.profiles.lookup(id: damus_state.pubkey)?.picture) != nil {
|
if (damus_state.profiles.lookup(id: damus_state.pubkey)?.picture) != nil {
|
||||||
ProfilePicView(pubkey: damus_state.pubkey, size: 90.0, highlight: .custom(Color("DamusWhite"), 4.0), profiles: damus_state.profiles)
|
ProfilePicView(pubkey: damus_state.pubkey, size: 90.0, highlight: .custom(DamusColors.white, 4.0), profiles: damus_state.profiles)
|
||||||
.padding(.top, 50)
|
.padding(.top, 50)
|
||||||
} else {
|
} else {
|
||||||
Image(systemName: "person.fill")
|
Image(systemName: "person.fill")
|
||||||
.font(.system(size: 60))
|
.font(.system(size: 60))
|
||||||
.foregroundColor(Color("DamusWhite"))
|
.foregroundColor(DamusColors.white)
|
||||||
.padding(.top, 50)
|
.padding(.top, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let display_name = profile?.display_name {
|
if let display_name = profile?.display_name {
|
||||||
Text(display_name)
|
Text(display_name)
|
||||||
.foregroundColor(Color("DamusWhite"))
|
.foregroundColor(DamusColors.white)
|
||||||
.font(.system(size: 24, weight: .heavy))
|
.font(.system(size: 24, weight: .heavy))
|
||||||
}
|
}
|
||||||
if let name = profile?.name {
|
if let name = profile?.name {
|
||||||
Text("@" + name)
|
Text("@" + name)
|
||||||
.foregroundColor(Color("DamusWhite"))
|
.foregroundColor(DamusColors.white)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,19 +73,19 @@ struct QRCodeView: View {
|
|||||||
.padding()
|
.padding()
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.overlay(RoundedRectangle(cornerRadius: 10)
|
.overlay(RoundedRectangle(cornerRadius: 10)
|
||||||
.stroke(Color("DamusWhite"), lineWidth: 1))
|
.stroke(DamusColors.white, lineWidth: 1))
|
||||||
.shadow(radius: 10)
|
.shadow(radius: 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
Text("Follow me on nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.")
|
Text("Follow me on nostr", comment: "Text on QR code view to prompt viewer looking at screen to follow the user.")
|
||||||
.foregroundColor(Color("DamusWhite"))
|
.foregroundColor(DamusColors.white)
|
||||||
.font(.system(size: 24, weight: .heavy))
|
.font(.system(size: 24, weight: .heavy))
|
||||||
.padding(.top)
|
.padding(.top)
|
||||||
|
|
||||||
Text("Scan the code", comment: "Text on QR code view to prompt viewer to scan the QR code on screen with their device camera.")
|
Text("Scan the code", comment: "Text on QR code view to prompt viewer to scan the QR code on screen with their device camera.")
|
||||||
.foregroundColor(Color("DamusWhite"))
|
.foregroundColor(DamusColors.white)
|
||||||
.font(.system(size: 18, weight: .ultraLight))
|
.font(.system(size: 18, weight: .ultraLight))
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ struct SideMenuView: View {
|
|||||||
let verticalSpacing: CGFloat = 20
|
let verticalSpacing: CGFloat = 20
|
||||||
|
|
||||||
func fillColor() -> Color {
|
func fillColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusWhite") : Color("DamusBlack")
|
colorScheme == .light ? DamusColors.white : DamusColors.black
|
||||||
}
|
}
|
||||||
|
|
||||||
func textColor() -> Color {
|
func textColor() -> Color {
|
||||||
colorScheme == .light ? Color("DamusBlack") : Color("DamusWhite")
|
colorScheme == .light ? DamusColors.black : DamusColors.white
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@@ -32,7 +32,7 @@ struct SideMenuView: View {
|
|||||||
GeometryReader { _ in
|
GeometryReader { _ in
|
||||||
EmptyView()
|
EmptyView()
|
||||||
}
|
}
|
||||||
.background(Color("DamusDarkGrey").opacity(0.6))
|
.background(DamusColors.darkGrey.opacity(0.6))
|
||||||
.opacity(isSidebarVisible ? 1 : 0)
|
.opacity(isSidebarVisible ? 1 : 0)
|
||||||
.animation(.default, value: isSidebarVisible)
|
.animation(.default, value: isSidebarVisible)
|
||||||
.onTapGesture {
|
.onTapGesture {
|
||||||
@@ -69,7 +69,7 @@ struct SideMenuView: View {
|
|||||||
}
|
}
|
||||||
if let name = profile?.name {
|
if let name = profile?.name {
|
||||||
Text("@" + name)
|
Text("@" + name)
|
||||||
.foregroundColor(Color("DamusMediumGrey"))
|
.foregroundColor(DamusColors.mediumGrey)
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user