@@ -173,30 +173,51 @@ struct ClockRow: View {
173173 . opacity ( weather ? . isStale == true ? 0.45 : 1 )
174174 }
175175
176- /// Countdown to the next sunrise or sunset there.
176+ /// Countdown to the next sunrise or sunset there: "☀︎↑ in 10h 38m" .
177177 @ ViewBuilder private var sunDetail : some View {
178178 switch sun {
179- case . sunrise ( let date ) : sunLabel ( " sunrise.fill " , . orange , countdown ( to : date ) )
180- case . sunset ( let date ) : sunLabel ( " sunset.fill " , . pink , countdown ( to : date ) )
181- case . polarDay : sunLabel ( " sun.max.fill " , . orange , " polar " )
182- case . polarNight : sunLabel ( " moon.fill " , . indigo , " polar " )
179+ case . sunrise ( let date ) : sunLabel ( " sun.horizon " , rising : true , countdown ( to : date ) )
180+ case . sunset ( let date ) : sunLabel ( " sun.horizon " , rising : false , countdown ( to : date ) )
181+ case . polarDay : sunLabel ( " sun.max " , rising : nil , " polar day " )
182+ case . polarNight : sunLabel ( " moon " , rising : nil , " polar night " )
183183 }
184184 }
185185
186- /// The arrow and horizon use the secondary text colour, which always stands out from the glass behind,
187- /// whatever the wallpaper. Only the sun carries colour, deepened slightly toward the text colour.
188- /// (A fixed faded colour was the same brightness as grey glass over a dark wallpaper and vanished.)
189- /// Single-layer symbols (the polar sun and moon) take the colour as a whole.
190- private func sunLabel ( _ symbol : String , _ color : Color , _ text : String ) -> some View {
191- let tint = AnyShapeStyle ( color . mix ( with : . primary , by : 0.2 ) )
192- return HStack ( alignment : . firstTextBaseline , spacing : 4 ) {
193- Image ( systemName : symbol )
194- . symbolRenderingMode ( . palette )
195- . foregroundStyle ( symbol . hasPrefix ( " sunrise " ) || symbol . hasPrefix ( " sunset " ) ? AnyShapeStyle ( . secondary ) : tint ,
196- tint , AnyShapeStyle ( . secondary ) )
197- . fontWeight ( . semibold )
198- . modifier ( IconSlot ( ) )
199- column ( text , template : " 00h 00m " )
186+ /// An outline sun on the horizon, an arrow for rising or setting, then the countdown.
187+ /// The sun and "in" use the secondary text colour, which always stands out from the glass behind,
188+ /// whatever the wallpaper. Only the arrow is coloured (orange up, pink down), deepened toward the text colour.
189+ private func sunLabel ( _ symbol : String , rising : Bool ? , _ text : String ) -> some View {
190+ HStack ( alignment : . firstTextBaseline , spacing : 4 ) {
191+ HStack ( alignment : . firstTextBaseline , spacing : 1 ) {
192+ Image ( systemName : symbol )
193+ . foregroundStyle ( . secondary )
194+ . fontWeight ( . semibold )
195+ . modifier ( IconSlot ( ) )
196+ Group {
197+ if let rising {
198+ Image ( systemName : rising ? " arrow.up " : " arrow.down " )
199+ . font ( . system ( size : 9 , weight : . heavy ) )
200+ . foregroundStyle ( ( rising ? Color . orange : . pink ) . mix ( with : . primary , by : 0.2 ) )
201+ } else {
202+ Color . clear . frame ( height : 1 )
203+ }
204+ }
205+ . frame ( width : 8 )
206+ }
207+ // Right-aligned and as wide as the longest wording, so countdowns line up from row to row.
208+ ZStack ( alignment : . trailing ) {
209+ Text ( " in 00h 00m " ) . hidden ( )
210+ Text ( " polar night " ) . hidden ( )
211+ if rising == nil {
212+ Text ( text ) . foregroundStyle ( . secondary )
213+ } else {
214+ HStack ( spacing : 3 ) {
215+ Text ( " in " ) . foregroundStyle ( . secondary )
216+ Text ( text )
217+ }
218+ }
219+ }
220+ . fixedSize ( )
200221 }
201222 }
202223
0 commit comments