File tree Expand file tree Collapse file tree 5 files changed +213
-250
lines changed Expand file tree Collapse file tree 5 files changed +213
-250
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ public struct Document {
22
22
public var stylesheets : [ String ] ?
23
23
public var theme : Theme ?
24
24
public let head : String ?
25
- private let contentBuilder : ( ) -> [ any HTML ]
25
+ public let contentBuilder : ( ) -> [ any HTML ]
26
26
27
27
/// Computed HTML content from the content builder.
28
28
var content : [ any HTML ] {
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ public enum Locale: String {
11
11
12
12
public struct ThemeColor {
13
13
public let light : String
14
- public let dark : String
14
+ public let dark : String ?
15
15
16
- public init ( light: String , dark: String ) {
16
+ public init ( _ light: String , dark: String ? = nil ) {
17
17
self . light = light
18
18
self . dark = dark
19
19
}
@@ -119,11 +119,13 @@ public struct Metadata {
119
119
}
120
120
if let themeColor {
121
121
baseTags. append (
122
- " <meta name= \" theme-color \" content= \" \( themeColor. light) \" media= \" (prefers-color-scheme: light) \" > "
123
- )
124
- baseTags. append (
125
- " <meta name= \" theme-color \" content= \" \( themeColor. dark) \" media= \" (prefers-color-scheme: dark) \" > "
122
+ " <meta name= \" theme-color \" content= \" \( themeColor. light) \" \( themeColor. dark != nil ? " media= \" (prefers-color-scheme: light) \" " : " " ) > "
126
123
)
124
+ if themeColor. dark != nil {
125
+ baseTags. append (
126
+ " <meta name= \" theme-color \" content= \" \( themeColor. dark) \" media= \" (prefers-color-scheme: dark) \" > "
127
+ )
128
+ }
127
129
}
128
130
129
131
return baseTags
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments