Fix wrong colors in PDF export
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CV: View {
|
||||
|
||||
@Environment(\.colorScheme)
|
||||
var colorScheme: ColorScheme
|
||||
|
||||
let info: CVInfo
|
||||
|
||||
@ -61,7 +64,7 @@ struct CV: View {
|
||||
Spacer(minLength: 0)
|
||||
Text(info.footer)
|
||||
.font(.footnote)
|
||||
.foregroundColor(.secondary)
|
||||
.foregroundColor(colorScheme.secondaryColor)
|
||||
}
|
||||
.padding()
|
||||
.aspectRatio(1 / sqrt(2), contentMode: .fit)
|
||||
|
@ -13,4 +13,20 @@ extension Color {
|
||||
init(_ r: Double, _ g: Double, _ b: Double) {
|
||||
self.init(red: r, green: g, blue: b)
|
||||
}
|
||||
|
||||
static var lightSchemePrimaryColor: Color {
|
||||
.init(r: 1, g: 1, b: 1)
|
||||
}
|
||||
|
||||
static var darkSchemePrimaryColor: Color {
|
||||
.init(r: 224, g: 224, b: 224)
|
||||
}
|
||||
|
||||
static var lightSchemeSecondaryColor: Color {
|
||||
.init(r: 128, g: 128, b: 128)
|
||||
}
|
||||
|
||||
static var darkSchemeSecondaryColor: Color {
|
||||
.init(r: 161, g: 161, b: 161)
|
||||
}
|
||||
}
|
||||
|
13
ResumeBuilder/ColorScheme+Extensions.swift
Normal file
13
ResumeBuilder/ColorScheme+Extensions.swift
Normal file
@ -0,0 +1,13 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
extension ColorScheme {
|
||||
|
||||
var primaryColor: Color {
|
||||
self == .light ? .lightSchemePrimaryColor : .darkSchemePrimaryColor
|
||||
}
|
||||
|
||||
var secondaryColor: Color {
|
||||
self == .light ? .lightSchemeSecondaryColor : .darkSchemeSecondaryColor
|
||||
}
|
||||
}
|
@ -205,7 +205,7 @@ struct ContentView: View {
|
||||
private var renderContent: some View {
|
||||
CV(info: info, style: style)
|
||||
.frame(width: style.pageWidth, height: style.pageHeight)
|
||||
.preferredColorScheme(.dark)
|
||||
.preferredColorScheme(colorStyle)
|
||||
}
|
||||
|
||||
@MainActor
|
||||
|
@ -3,6 +3,9 @@ import SFSafeSymbols
|
||||
|
||||
struct CareerStationView: View {
|
||||
|
||||
@Environment(\.colorScheme)
|
||||
var colorScheme: ColorScheme
|
||||
|
||||
let info: CareerStation
|
||||
|
||||
let borderSpacing: CGFloat
|
||||
@ -20,7 +23,7 @@ struct CareerStationView: View {
|
||||
RightImageLabel(info.location, systemSymbol: .house)
|
||||
}
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.foregroundColor(colorScheme.secondaryColor)
|
||||
Text(info.title)
|
||||
.font(.headline)
|
||||
.fontWeight(.regular)
|
||||
@ -32,7 +35,7 @@ struct CareerStationView: View {
|
||||
if let text = info.text {
|
||||
Text(text)
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.foregroundColor(colorScheme.secondaryColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PublicationView: View {
|
||||
|
||||
|
||||
@Environment(\.colorScheme)
|
||||
var colorScheme: ColorScheme
|
||||
|
||||
let info: Publication
|
||||
|
||||
let borderSpacing: CGFloat
|
||||
@ -15,10 +18,11 @@ struct PublicationView: View {
|
||||
VStack(alignment: .leading) {
|
||||
Text(info.venue)
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.foregroundColor(colorScheme.secondaryColor)
|
||||
Text(info.title)
|
||||
.font(.subheadline)
|
||||
.fontWeight(.regular)
|
||||
.foregroundColor(colorScheme.primaryColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
import SwiftUI
|
||||
|
||||
struct TitledTextSection: View {
|
||||
|
||||
@Environment(\.colorScheme)
|
||||
var colorScheme: ColorScheme
|
||||
|
||||
let content: Titled<String>
|
||||
|
||||
@ -8,6 +11,10 @@ struct TitledTextSection: View {
|
||||
|
||||
let paragraphSpacing: CGFloat
|
||||
|
||||
private var textColor: Color {
|
||||
colorScheme == .light ? .lightSchemePrimaryColor : .darkSchemePrimaryColor
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
TitledSection(title: content.title, spacing: titleSpacing) {
|
||||
ForEach(content.items) { text in
|
||||
@ -15,6 +22,7 @@ struct TitledTextSection: View {
|
||||
.font(.body)
|
||||
.fontWeight(.light)
|
||||
.padding(.bottom, paragraphSpacing)
|
||||
.foregroundColor(textColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user