mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-12-03 20:01:50 +01:00
- The accent is a flat fill. With gradients on (now off by default) it shades into a darker tone of itself, never into orchid. - Copper gets a 100-700 scale; as an accent on dark it uses the lit 400. iOS shows the copper rating star and new-episodes badge like Android. - Every scrim over artwork follows one eased curve (SCRIM_STOPS), layered by job instead of one many-stop ramp. The desktop banner is taller and loses its full-picture wash. - One solid focus ring on every client; the TV gradient border and the desktop's inner copper ring are gone. - Missing art is a plain card with initials, not a hashed colour ramp. - A portrait poster in a landscape card fills the frame with a dimmed crop of itself.
26 lines
1.0 KiB
Swift
26 lines
1.0 KiB
Swift
import SwiftUI
|
|
|
|
/// `pstr_core::appearance::SCRIM_STOPS`: the suite's one fade, opacity from the
|
|
/// solid end to the clear one at nine evenly spaced stops.
|
|
///
|
|
/// Eased (`1 - smoothstep`), flat at both ends, so a scrim over artwork has no
|
|
/// line where it starts or stops. The desktop draws the same curve, and a test
|
|
/// there pins these numbers to it. Android's copy is `ui/theme/Scrim.kt`.
|
|
private let scrimStops: [Double] = [1, 0.957, 0.844, 0.684, 0.5, 0.316, 0.156, 0.043, 0]
|
|
|
|
/// A fade in `color` from `start` (opaque) to `end` (clear), over the
|
|
/// fractions `from` to `to` of the way between them.
|
|
func scrim(
|
|
_ color: Color,
|
|
from: Double = 0,
|
|
to: Double = 1,
|
|
start: UnitPoint = .bottom,
|
|
end: UnitPoint = .top
|
|
) -> LinearGradient {
|
|
let last = Double(scrimStops.count - 1)
|
|
let stops = scrimStops.enumerated().map { index, opacity in
|
|
Gradient.Stop(color: color.opacity(opacity), location: from + (to - from) * Double(index) / last)
|
|
}
|
|
return LinearGradient(stops: stops, startPoint: start, endPoint: end)
|
|
}
|