From c6ad3712b1a5646e17d9e6a64bfac82450479c1e Mon Sep 17 00:00:00 2001 From: tresby <67149553+tresby@users.noreply.github.com> Date: Mon, 28 Sep 2026 22:56:06 +0800 Subject: [PATCH] Brighten green subtitle text Styled subtitles mapped the "green" colour class to HTML's dim #008000, and the appearance editor's Green preset was a washed-out pastel. Both read poorly over the semi-transparent caption background next to the other, fully saturated caption colours. Both now use one bright broadcast (CEA-608) caption green, #00FF00, defined once as SubtitleColor.green so the preview, the preset and markup-coloured cues always match. Co-Authored-By: Claude Opus 5.5 --- Sources/CoreModels/SubtitleMarkup.swift | 6 ++++-- Sources/CoreModels/SubtitlePrimitives.swift | 3 ++- Tests/CoreModelsTests/SubtitleMarkupTests.swift | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Sources/CoreModels/SubtitleMarkup.swift b/Sources/CoreModels/SubtitleMarkup.swift index 648f3220b..6de6695ce 100644 --- a/Sources/CoreModels/SubtitleMarkup.swift +++ b/Sources/CoreModels/SubtitleMarkup.swift @@ -290,8 +290,10 @@ extension SubtitleColor { "white": .init(red: 1, green: 1, blue: 1), "black": .init(red: 0, green: 0, blue: 0), "red": .init(red: 1, green: 0, blue: 0), - "lime": .init(red: 0, green: 1, blue: 0), - "green": .init(red: 0, green: 0.5, blue: 0), + "lime": .green, + // Caption "green" means the bright broadcast (CEA-608) green, not HTML's + // dim #008000, which reads as murky over video. + "green": .green, "blue": .init(red: 0, green: 0, blue: 1), "yellow": .init(red: 1, green: 1, blue: 0), "cyan": .init(red: 0, green: 1, blue: 1), diff --git a/Sources/CoreModels/SubtitlePrimitives.swift b/Sources/CoreModels/SubtitlePrimitives.swift index e52ed2e4e..3eeb34494 100644 --- a/Sources/CoreModels/SubtitlePrimitives.swift +++ b/Sources/CoreModels/SubtitlePrimitives.swift @@ -30,7 +30,8 @@ public struct SubtitleColor: Codable, Equatable, Sendable, Hashable { public static let cyan = SubtitleColor(red: 0.25, green: 0.85, blue: 1) public static let pink = SubtitleColor(red: 1, green: 0.55, blue: 0.75) public static let orange = SubtitleColor(red: 1, green: 0.6, blue: 0.15) - public static let green = SubtitleColor(red: 0.45, green: 0.85, blue: 0.45) + /// Broadcast (CEA-608) caption green, shared by the preset and markup colours. + public static let green = SubtitleColor(red: 0, green: 1, blue: 0) public static let clear = SubtitleColor(red: 0, green: 0, blue: 0, alpha: 0) /// The curated palette offered by the appearance editor's colour picker. diff --git a/Tests/CoreModelsTests/SubtitleMarkupTests.swift b/Tests/CoreModelsTests/SubtitleMarkupTests.swift index 2b12ef982..685559ed6 100644 --- a/Tests/CoreModelsTests/SubtitleMarkupTests.swift +++ b/Tests/CoreModelsTests/SubtitleMarkupTests.swift @@ -45,6 +45,12 @@ final class SubtitleMarkupTests: XCTestCase { XCTAssertNil(t.runs?.last?.color) } + func testWebVTTGreenClassIsBrightCaptionGreen() throws { + let t = try text("WEBVTT\n\n00:00:01.000 --> 00:00:02.000\nCaller: hi\n") + XCTAssertEqual(t.runs?.first?.color, SubtitleColor(red: 0, green: 1, blue: 0)) + XCTAssertEqual(t.runs?.first?.color, .green, "markup and the Green preset must match") + } + func testEntitiesDecodeInsideRuns() throws { let t = try text("1\n00:00:01,000 --> 00:00:02,000\nTom & Jerry\n") XCTAssertEqual(t.string, "Tom & Jerry")