feat: add colors

This commit is contained in:
greyder 2022-06-05 10:55:25 +08:00
parent a4a60dd41d
commit 36888ee50c
6 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.934",
"green" : "0.934",
"red" : "0.934"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.070",
"green" : "0.070",
"red" : "0.070"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -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
}
}

View File

@ -0,0 +1,26 @@
import SwiftUI
struct BackgroundView<Content: View>: View {
let color: Color
var content: () -> Content
init(color: Color = .background, @ViewBuilder content: @escaping () -> Content) {
self.color = color
self.content = content
}
var body: some View {
ZStack {
color.edgesIgnoringSafeArea(.all)
content()
}
}
}
struct BackgroundView_Previews: PreviewProvider {
static var previews: some View {
BackgroundView() {
Text("Hello")
}
}
}

View File

@ -0,0 +1,19 @@
//
// File.swift
//
//
// Created by Yhanco Grey Esteban on 6/5/22.
//
import SwiftUI
public extension Color {
static var background: Color {
return Color("Background")
}
static var foreground: Color {
return Color("Foreground")
}
}