From 8f6358d5967891fb3fcf719be10dd1647d1b3ace Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 10 May 2022 17:22:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=80=E3=83=BC=E3=82=AF=E3=83=A2=E3=83=BC?= =?UTF-8?q?=E3=83=89=E5=AF=BE=E5=BF=9C=E3=83=BBcolor=20set=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AgileWorks/Common/WidgetView.swift | 15 ++++++++-- .../Contents.json | 28 +++++++++++++++++++ .../WidgetBoxColor.colorset/Contents.json | 28 +++++++++++++++++++ .../WidgetTextColor.colorset/Contents.json | 28 +++++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 AgileWorks/WidgetExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json create mode 100644 AgileWorks/WidgetExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json create mode 100644 AgileWorks/WidgetExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json diff --git a/AgileWorks/Common/WidgetView.swift b/AgileWorks/Common/WidgetView.swift index 19fadfa..136a249 100644 --- a/AgileWorks/Common/WidgetView.swift +++ b/AgileWorks/Common/WidgetView.swift @@ -121,7 +121,7 @@ struct StatusBoxView: View { func backColor() -> Color { if #available(iOS 14.0, *) { - return Color(UIColor.systemGray6) + return Color.backgroundColor } else { return Color(UIColor.clear) } @@ -268,12 +268,15 @@ struct ApprovalItemView: View { HStack(spacing: 0) { Image(systemName: "folder") .frame(width: geometry.size.width * 0.3, height: geometry.size.height) + .foregroundColor(Color.textColor) if message == nil { VStack(alignment: .leading) { Text(approvalItem.name) .frame(alignment: .leading) + .foregroundColor(Color.textColor) Text("\(approvalItem.count)").font(.subheadline) .frame(alignment: .leading) + .foregroundColor(Color.textColor) } } else { //APIサーバーエラーの場合の表示 Text(message ?? "-") @@ -281,7 +284,7 @@ struct ApprovalItemView: View { } Spacer() } - .background(Color.white) + .background(Color.widgetBoxColor) .cornerRadius(20) } } @@ -292,5 +295,13 @@ struct FailureWidgetView: View { var body: some View { Text(entry.message ?? "") + .foregroundColor(Color.textColor) } } + +extension Color { + static let backgroundColor = Color("WidgetBackgroundColor") + static let widgetBoxColor = Color("WidgetBoxColor") + static let textColor = Color("WidgetTextColor") +} + diff --git a/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json new file mode 100644 index 0000000..12ac8cf --- /dev/null +++ b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "ios", + "reference" : "systemGray6Color" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "systemGray6Color" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json new file mode 100644 index 0000000..ca5bf10 --- /dev/null +++ b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "ios", + "reference" : "systemBackgroundColor" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "systemGray5Color" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/WidgetExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json new file mode 100644 index 0000000..1effc4f --- /dev/null +++ b/AgileWorks/WidgetExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "universal", + "reference" : "labelColor" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "universal", + "reference" : "labelColor" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} -- GitLab