mirror of
https://github.com/yattee/yattee.git
synced 2025-10-10 17:38:15 +00:00
SponsorBlock set colors for each category
Default colors are defined in alignment to upstream. These can be changed by the user. The colors are also used in the Timeline and the seek view.
This commit is contained in:
@@ -243,6 +243,7 @@ extension Defaults.Keys {
|
||||
|
||||
static let sponsorBlockInstance = Key<String>("sponsorBlockInstance", default: "https://sponsor.ajay.app")
|
||||
static let sponsorBlockCategories = Key<Set<String>>("sponsorBlockCategories", default: Set(SponsorBlockAPI.categories))
|
||||
static let sponsorBlockColors = Key<[String: String]>("sponsorBlockColors", default: SponsorBlockColors.dictionary)
|
||||
|
||||
// MARK: GROUP - Locations
|
||||
|
||||
@@ -580,3 +581,26 @@ enum WidgetListingStyle: String, CaseIterable, Defaults.Serializable {
|
||||
case horizontalCells
|
||||
case list
|
||||
}
|
||||
|
||||
enum SponsorBlockColors: String {
|
||||
case sponsor = "#00D400" // Green
|
||||
case selfpromo = "#FFFF00" // Yellow
|
||||
case interaction = "#CC00FF" // Purple
|
||||
case intro = "#00FFFF" // Cyan
|
||||
case outro = "#0202ED" // Dark Blue
|
||||
case preview = "#008FD6" // Light Blue
|
||||
case filler = "#7300FF" // Violet
|
||||
case music_offtopic = "#FF9900" // Orange
|
||||
|
||||
// Define all cases, can be used to iterate over the colors
|
||||
static let allCases: [SponsorBlockColors] = [.sponsor, .selfpromo, .interaction, .intro, .outro, .preview, .filler, .music_offtopic]
|
||||
|
||||
// Create a dictionary with the category names as keys and colors as values
|
||||
static let dictionary: [String: String] = {
|
||||
var dict = [String: String]()
|
||||
for item in allCases {
|
||||
dict[String(describing: item)] = item.rawValue
|
||||
}
|
||||
return dict
|
||||
}()
|
||||
}
|
||||
|
Reference in New Issue
Block a user