设置页面背景色为 f2f2f7
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// Color+Hex.swift
|
||||
// Note
|
||||
//
|
||||
// Created by fish on 2026/7/12.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
extension Color {
|
||||
init(hex: String) {
|
||||
let trimmed = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
var int: UInt64 = 0
|
||||
Scanner(string: trimmed).scanHexInt64(&int)
|
||||
let r, g, b: UInt64
|
||||
switch trimmed.count {
|
||||
case 6:
|
||||
r = (int >> 16) & 0xFF
|
||||
g = (int >> 8) & 0xFF
|
||||
b = int & 0xFF
|
||||
case 8:
|
||||
r = (int >> 16) & 0xFF
|
||||
g = (int >> 8) & 0xFF
|
||||
b = int & 0xFF
|
||||
default:
|
||||
r = 0
|
||||
g = 0
|
||||
b = 0
|
||||
}
|
||||
self.init(
|
||||
.sRGB,
|
||||
red: Double(r) / 255,
|
||||
green: Double(g) / 255,
|
||||
blue: Double(b) / 255,
|
||||
opacity: 1
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ struct FormatterView: View {
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("文案格式化")
|
||||
.background(Color(hex: "f2f2f7").ignoresSafeArea())
|
||||
.navigationDestination(item: $resultText) { text in
|
||||
ResultView(formattedText: text)
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ struct ResultView: View {
|
||||
}
|
||||
.navigationTitle("格式化结果")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.background(Color(hex: "f2f2f7").ignoresSafeArea())
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button("完成") {
|
||||
|
||||
Reference in New Issue
Block a user