Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public final class Coordinator {

/// Logs once per deck when Syndicate's color for it is black, which DeckColors replaces with the default.
private func noteBlackSlot(_ numbers: [Int]) -> [Int] {
if numbers.count >= 4, numbers[0] % 2 == 1, (1...7).contains(numbers[0]), DeckColors.isBlack(numbers[1...3]) {
let deck = (numbers[0] + 1) / 2
if numbers.count >= 4, let deck = DeckColors.deck(forSlot: numbers[0]), DeckColors.isBlack(numbers[1...3]) {
if loggedBlackDecks.insert(deck).inserted {
log.log("Syndicate's deck \(deck) color is black, which the LC6000's ring can't show; using the default")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ public struct DeckColors: Equatable, Sendable, Codable {
4: [0x62, 0x92, 0x9E],
])

/// The deck whose color a cue palette slot holds: slots 1, 3, 5 and 7 are decks 1-4 (#123). Nil for any other.
public static func deck(forSlot slot: Int) -> Int? {
slot % 2 == 1 && (1...7).contains(slot) ? (slot + 1) / 2 : nil
}

/// After a ColorPalette message ([slot, r, g, b]): the deck whose slot it is (slot 2N−1 is deck N) takes the color.
/// Nil when the message isn't a deck's slot, so nothing needs repainting.
public func updated(byPalette numbers: [Int]) -> DeckColors? {
guard numbers.count >= 4, numbers[0] % 2 == 1, (1...7).contains(numbers[0]) else { return nil }
let deck = (numbers[0] + 1) / 2
guard numbers.count >= 4, let deck = Self.deck(forSlot: numbers[0]) else { return nil }
var out = self
// Black would turn the ring off: that deck keeps its default color.
out.rgb[deck] = Self.isBlack(numbers[1...3]) ? Self.defaults[deck] : Array(numbers[1...3])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,4 @@ public enum Palette {
accent: RGB(hex: 0x00FF48), // --signal
onAccent: RGB(hex: 0x111111) // --on-signal
)

// The dark theme's colors by name, for code that doesn't follow the appearance yet.
public static let background = dark.background
public static let panel = dark.panel
public static let button = dark.button
public static let buttonRaised = dark.buttonRaised
public static let hairline = dark.hairline
public static let buttonEdge = dark.buttonEdge
public static let selectedBar = dark.selectedBar
public static let text = dark.text
public static let caption = dark.caption
public static let live = dark.live
public static let attention = dark.attention
public static let error = dark.error
public static let key = dark.key
public static let accent = dark.accent
}
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,6 @@ public struct StatusPresentation: Equatable, Sendable {
}

extension StatusLight.Tone {
/// The tone in the dark theme.
public var color: RGB { color(in: Palette.dark) }

/// The tone in a theme (#127): each passes AA on that theme's surfaces.
public func color(in palette: ThemePalette) -> RGB {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ struct StatusPresentationTests {
(.error, 0xE06C6C),
] as [(StatusLight.Tone, UInt32)])
func toneColors(tone: StatusLight.Tone, hex: UInt32) {
#expect(tone.color == RGB(hex: hex))
#expect(tone.color(in: Palette.dark) == RGB(hex: hex))
}

Expand Down
Loading