From 0e331a46a8633cfbd513ee55001572a0251295a5 Mon Sep 17 00:00:00 2001 From: Takuya Aso Date: Tue, 14 Dec 2021 00:08:49 +0900 Subject: [PATCH] Added Color for gradation corresponding to Light/Dark mode. --- SwipePageChanger.xcodeproj/project.pbxproj | 22 ++++++++++- .../Assets.xcassets/Colors/Contents.json | 6 +++ .../gradationColor.colorset/Contents.json | 38 +++++++++++++++++++ SwipePageChanger/Extension/Color+Assets.swift | 12 ++++++ .../{ => View}/Top/FloatingButtonView.swift | 0 .../{ => View}/Top/PageContentView.swift | 0 .../{ => View}/Top/ToolBarViewModifier.swift | 4 +- .../{ => View}/Top/TopBarSliderView.swift | 0 .../{ => View}/Top/TopContentView.swift | 0 9 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 SwipePageChanger/Assets.xcassets/Colors/Contents.json create mode 100644 SwipePageChanger/Assets.xcassets/Colors/gradationColor.colorset/Contents.json create mode 100644 SwipePageChanger/Extension/Color+Assets.swift rename SwipePageChanger/{ => View}/Top/FloatingButtonView.swift (100%) rename SwipePageChanger/{ => View}/Top/PageContentView.swift (100%) rename SwipePageChanger/{ => View}/Top/ToolBarViewModifier.swift (97%) rename SwipePageChanger/{ => View}/Top/TopBarSliderView.swift (100%) rename SwipePageChanger/{ => View}/Top/TopContentView.swift (100%) diff --git a/SwipePageChanger.xcodeproj/project.pbxproj b/SwipePageChanger.xcodeproj/project.pbxproj index e3d0861..e2f76f1 100644 --- a/SwipePageChanger.xcodeproj/project.pbxproj +++ b/SwipePageChanger.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + FD7321E12767986400927135 /* Color+Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD7321E02767986400927135 /* Color+Assets.swift */; }; FDD1A47A27632DB5005D6A63 /* SwipePageChangerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDD1A47927632DB5005D6A63 /* SwipePageChangerApp.swift */; }; FDD1A47E27632DB6005D6A63 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FDD1A47D27632DB6005D6A63 /* Assets.xcassets */; }; FDD1A48127632DB6005D6A63 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FDD1A48027632DB6005D6A63 /* Preview Assets.xcassets */; }; @@ -19,6 +20,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + FD7321E02767986400927135 /* Color+Assets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Assets.swift"; sourceTree = ""; }; FDD1A47627632DB5005D6A63 /* SwipePageChanger.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwipePageChanger.app; sourceTree = BUILT_PRODUCTS_DIR; }; FDD1A47927632DB5005D6A63 /* SwipePageChangerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipePageChangerApp.swift; sourceTree = ""; }; FDD1A47D27632DB6005D6A63 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -42,6 +44,22 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + FD7321DE2767982700927135 /* Extension */ = { + isa = PBXGroup; + children = ( + FD7321E02767986400927135 /* Color+Assets.swift */, + ); + path = Extension; + sourceTree = ""; + }; + FD7321DF2767983A00927135 /* View */ = { + isa = PBXGroup; + children = ( + FDD1A487276333D7005D6A63 /* Top */, + ); + path = View; + sourceTree = ""; + }; FDD1A46D27632DB4005D6A63 = { isa = PBXGroup; children = ( @@ -62,7 +80,8 @@ isa = PBXGroup; children = ( FDD1A47927632DB5005D6A63 /* SwipePageChangerApp.swift */, - FDD1A487276333D7005D6A63 /* Top */, + FD7321DF2767983A00927135 /* View */, + FD7321DE2767982700927135 /* Extension */, FDD1A4922763D431005D6A63 /* Data */, FDD1A47D27632DB6005D6A63 /* Assets.xcassets */, FDD1A47F27632DB6005D6A63 /* Preview Content */, @@ -170,6 +189,7 @@ files = ( FDD1A4942763D44C005D6A63 /* Constant.swift in Sources */, FDD1A48B27634121005D6A63 /* ToolBarViewModifier.swift in Sources */, + FD7321E12767986400927135 /* Color+Assets.swift in Sources */, FDD1A49127639CEB005D6A63 /* PageContentView.swift in Sources */, FDD1A489276333F7005D6A63 /* TopContentView.swift in Sources */, FDD1A47A27632DB5005D6A63 /* SwipePageChangerApp.swift in Sources */, diff --git a/SwipePageChanger/Assets.xcassets/Colors/Contents.json b/SwipePageChanger/Assets.xcassets/Colors/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SwipePageChanger/Assets.xcassets/Colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwipePageChanger/Assets.xcassets/Colors/gradationColor.colorset/Contents.json b/SwipePageChanger/Assets.xcassets/Colors/gradationColor.colorset/Contents.json new file mode 100644 index 0000000..0425637 --- /dev/null +++ b/SwipePageChanger/Assets.xcassets/Colors/gradationColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000", + "red" : "0.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwipePageChanger/Extension/Color+Assets.swift b/SwipePageChanger/Extension/Color+Assets.swift new file mode 100644 index 0000000..ebd27c2 --- /dev/null +++ b/SwipePageChanger/Extension/Color+Assets.swift @@ -0,0 +1,12 @@ +// +// Color+Assets.swift +// SwipePageChanger +// +// Created by Takuya Aso on 2021/12/14. +// + +import SwiftUI + +extension Color { + static let gradation = Color("gradationColor") +} diff --git a/SwipePageChanger/Top/FloatingButtonView.swift b/SwipePageChanger/View/Top/FloatingButtonView.swift similarity index 100% rename from SwipePageChanger/Top/FloatingButtonView.swift rename to SwipePageChanger/View/Top/FloatingButtonView.swift diff --git a/SwipePageChanger/Top/PageContentView.swift b/SwipePageChanger/View/Top/PageContentView.swift similarity index 100% rename from SwipePageChanger/Top/PageContentView.swift rename to SwipePageChanger/View/Top/PageContentView.swift diff --git a/SwipePageChanger/Top/ToolBarViewModifier.swift b/SwipePageChanger/View/Top/ToolBarViewModifier.swift similarity index 97% rename from SwipePageChanger/Top/ToolBarViewModifier.swift rename to SwipePageChanger/View/Top/ToolBarViewModifier.swift index 2c36b6f..edb7cf6 100644 --- a/SwipePageChanger/Top/ToolBarViewModifier.swift +++ b/SwipePageChanger/View/Top/ToolBarViewModifier.swift @@ -72,11 +72,11 @@ struct ToolBarViewModifier: ViewModifier { } HStack { - LinearGradient(gradient: Gradient(colors: [.white, .white.opacity(0.1)]), + LinearGradient(gradient: Gradient(colors: [.gradation, .gradation.opacity(0.1)]), startPoint: .leading, endPoint: .trailing) .frame(width: 8.0, height: 44.0) Spacer() - LinearGradient(gradient: Gradient(colors: [.white.opacity(0.1), .white]), + LinearGradient(gradient: Gradient(colors: [.gradation.opacity(0.1), .gradation]), startPoint: .leading, endPoint: .trailing) .frame(width: 8.0, height: 44.0) } diff --git a/SwipePageChanger/Top/TopBarSliderView.swift b/SwipePageChanger/View/Top/TopBarSliderView.swift similarity index 100% rename from SwipePageChanger/Top/TopBarSliderView.swift rename to SwipePageChanger/View/Top/TopBarSliderView.swift diff --git a/SwipePageChanger/Top/TopContentView.swift b/SwipePageChanger/View/Top/TopContentView.swift similarity index 100% rename from SwipePageChanger/Top/TopContentView.swift rename to SwipePageChanger/View/Top/TopContentView.swift