Files
Lyrebird/Sources/LyrebirdUI/LyrebirdMessageHelpers.swift
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

62 lines
1.7 KiB
Swift

// LyrebirdMessageHelpers.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if canImport(SwiftUI)
import SwiftUI
import LyrebirdSynth
/// Module-internal styling helpers shared between ``LyrebirdMessageView``
/// and ``LyrebirdMessageBanner``.
///
/// Lives in a `*Helpers.swift` per the project rule for shared file-scope
/// helpers used across more than one source file.
enum LyrebirdMessageTierStyle {
static func color(for tier: LyrebirdMessageTier) -> Color {
switch tier {
case .info: return .blue
case .warning: return .orange
case .error: return .red
}
}
static func shortLabel(for tier: LyrebirdMessageTier) -> String {
switch tier {
case .info: return "INFO"
case .warning: return "WARN"
case .error: return "ERR"
}
}
}
#else
// Linux/GTK4 counterpart to the Apple `LyrebirdMessageTierStyle`. Identical
// per-tier colour/label mapping; `Color` here is SwiftOpenUI's, not SwiftUI's.
//
// SwiftOpenUI is always present in this target (see Package.swift).
import SwiftOpenUI
import LyrebirdSynth
/// Module-internal styling helpers shared between ``LyrebirdMessageView``
/// and ``LyrebirdMessageBanner`` on Linux/GTK4.
enum LyrebirdMessageTierStyle {
static func color(for tier: LyrebirdMessageTier) -> Color {
switch tier {
case .info: return .blue
case .warning: return .orange
case .error: return .red
}
}
static func shortLabel(for tier: LyrebirdMessageTier) -> String {
switch tier {
case .info: return "INFO"
case .warning: return "WARN"
case .error: return "ERR"
}
}
}
#endif