From 9d3e5ddc86f11def94c1be6a4cfbc65143e7479b Mon Sep 17 00:00:00 2001 From: importRyan Date: Sat, 13 Mar 2021 11:29:21 -0800 Subject: [PATCH] Codable+ for ICSRGBA. Moved palettes to app. --- .../Experimental/ICJzazbzColorSpace.swift | 67 ++ .../InclusiveColorTools.swift | 4 - .../Models/SRGBA/IC_SRGBA.swift | 4 +- .../_Helpers/GammaEncodingDecoding.swift | 1 + .../Palettes/AllieOfisher/AllieOfisher.swift | 128 --- .../BrewerHarrower+Diverging.swift | 183 ---- .../BrewerHarrower+Sequential.swift | 216 ----- .../BrewerHarrower+SequentialMultihue.swift | 250 ------ .../BrewerHarrower/BrewerHarrower.swift | 37 - .../FabioCrameri/Cameri+Diverging.swift | 412 --------- .../FabioCrameri/Crameri+Cyclic.swift | 222 ----- .../Crameri+MultiSequential.swift | 139 --- .../FabioCrameri/Crameri+Sequential.swift | 815 ------------------ .../Palettes/FabioCrameri/FabioCrameri.swift | 33 - .../Palettes/IBM/IBM.swift | 49 -- .../Palettes/ICPalettes.swift | 249 ------ .../Palettes/JamieNunez/Nunez+Cividis.swift | 175 ---- .../Palettes/Licenses.swift | 163 ---- .../MasatakaOkabe/MasatakaOkabe.swift | 50 -- .../PaulTol/PaulTol+DivergingData.swift | 152 ---- .../PaulTol/PaulTol+QualitativeData.swift | 297 ------- .../PaulTol/PaulTol+SequentialData.swift | 369 -------- .../Palettes/PaulTol/PaulTol.swift | 30 - .../Palettes/_Models/AccessiblePalette.swift | 34 - .../_Models/ICPaletteUtilityTag.swift | 32 - .../Palettes/_Models/ICSourceColorSet.swift | 9 - .../Palettes/_UI+/ICPalettes+AppKit.swift | 32 - .../Palettes/_UI+/ICPalettes+SwiftUI.swift | 36 - .../Palettes/_UI+/ICPalettes+UIKit.swift | 32 - .../InclusiveColorTests.swift | 1 - .../InclusiveColorToolsTests.swift | 1 - .../CustomDeltaE/JzazbzColorSpaceTests.swift | 16 + .../Tools/Palettes/PalettesTests+AppKit.swift | 46 - .../Palettes/PalettesTests+SwiftUI.swift | 44 - .../InclusiveColorTests/XCTestManifests.swift | 2 - 35 files changed, 86 insertions(+), 4244 deletions(-) delete mode 100644 Sources/InclusiveColorTools/Palettes/AllieOfisher/AllieOfisher.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Diverging.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Sequential.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+SequentialMultihue.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/FabioCrameri/Cameri+Diverging.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Cyclic.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+MultiSequential.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Sequential.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/FabioCrameri/FabioCrameri.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/IBM/IBM.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/ICPalettes.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/JamieNunez/Nunez+Cividis.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/Licenses.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/MasatakaOkabe/MasatakaOkabe.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+DivergingData.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+QualitativeData.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+SequentialData.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_Models/AccessiblePalette.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_Models/ICPaletteUtilityTag.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_Models/ICSourceColorSet.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+AppKit.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+SwiftUI.swift delete mode 100644 Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+UIKit.swift delete mode 100644 Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+AppKit.swift delete mode 100644 Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+SwiftUI.swift diff --git a/Sources/InclusiveColorTools/Assess/Metrics/Experimental/ICJzazbzColorSpace.swift b/Sources/InclusiveColorTools/Assess/Metrics/Experimental/ICJzazbzColorSpace.swift index 485d46f..92cd5ae 100644 --- a/Sources/InclusiveColorTools/Assess/Metrics/Experimental/ICJzazbzColorSpace.swift +++ b/Sources/InclusiveColorTools/Assess/Metrics/Experimental/ICJzazbzColorSpace.swift @@ -83,6 +83,55 @@ public struct ICJzazbzColorSpace { atan(color.z / color.y) } + /// Convert Jzazbz color to srgb + /// + /// - Parameter Jzazbz D65 color vector (J: absolute lightness, a: red-green, b: yellow-blue) + /// + /// - Returns: sRGB gamma-encoded D65 color vector + /// + /// [Safdar, Muhammad et al. 2017](https://www.osapublishing.org/oe/fulltext.cfm?uri=oe-25-13-15131&id=368272) + /// [Figshare Code Repo](https://figshare.com/articles/code/JzAzBz_m/5016299) + /// [Example Implementation](http://im.snibgo.com/jzazbz.htm) + /// + public static func transformJzazbzToSRGB(_ jzazbz: ICJzazbzColor) -> sRGBColor { + let eqA17iab = _equation17ReverseIAB(jzazbz) + let eqA18lms_ = simd_mul(k.iabD65toLMSD65Matrix, eqA17iab) + let eqA19lms = _equation19ReversePerceptualQuantizerEOTF(eqA18lms_) + let eqA20_23xyzd65 = _equation20to23LMStoXYZ(eqA19lms) + return _XYZtoSRGB(eqA20_23xyzd65) + } + + static func _equation17ReverseIAB(_ jzazbz: ICJzazbzColor) -> ICIABColor { + let denominator = 1 + k.d - k.d * (jzazbz[0] + k.d0) + let i = (jzazbz[0] + k.d0) / denominator + return ICIABColor(i, jzazbz[1], jzazbz[2]) + } + + static func _equation19ReversePerceptualQuantizerEOTF(_ input: ICLMS) -> ICLMS { + + func dequantize(_ channel: ICLMS.Scalar) -> ICLMS.Scalar { + let numerator = k.c1 - pow(channel, 1/k.p) + let denominator = k.c3 * pow(channel, 1/k.p) - k.c2 + let inverse = pow((numerator/denominator), 1/k.n) + return inverse * k.maxCandelasPerM2 + } + + return ICLMS(dequantize(input.x), dequantize(input.y), dequantize(input.z)) + } + + static func _equation20to23LMStoXYZ(_ lms: ICLMS) -> ICXYZColor { + let xyz_ = simd_mul(k.LMSD65toXYZD65Matrix, lms) + let x = (xyz_[0] + (k.b - 1) * xyz_[2]) / k.b + let y = (xyz_[1] + (k.g - 1) * xyz_[0]) / k.g + let z = xyz_[2] + return ICXYZColor(x, y, z) + } + + static func _XYZtoSRGB(_ xyz: ICXYZColor) -> sRGBColor { + let linearRGB = simd_mul(k.XYZD65tolinearRGBMatrix, xyz) + return linearRGB.encodeGamma() + } + } fileprivate extension ICJzazbzColorSpace { @@ -120,6 +169,24 @@ fileprivate extension ICJzazbzColorSpace { static let d: ICJzazbzColor.Scalar = -0.56 static let d0: ICJzazbzColor.Scalar = 1.6295499532821566 * pow(10, -11) static let maxCandelasPerM2 = ICJzazbzColor.Scalar(10000) + + static let iabD65toLMSD65Matrix = simd_float3x3(rows: [ + SIMD3(1, 0.13860504, 0.05804731), + SIMD3(1, -0.13860504, -0.05804731), + SIMD3(1, -0.09601924, -0.81189189) + ]) + + static let LMSD65toXYZD65Matrix = simd_float3x3(rows: [ + SIMD3( 2.35500, -0.11180, -0.04272), + SIMD3( 0.42870, 0.88910, -0.08002), + SIMD3(-0.11130, -0.35550, 1.52700) + ]) + + static let XYZD65tolinearRGBMatrix = simd_float3x3(rows: [ + SIMD3( 3.2404542, -1.5371385, -0.4985314), + SIMD3(-0.9692660, 1.8760108, 0.0415560), + SIMD3( 0.0556434, -0.2040259, 1.0572252) + ]) } static func convertSRGBtoXYZD65(_ srgb: sRGBColor) -> ICXYZColor { diff --git a/Sources/InclusiveColorTools/InclusiveColorTools.swift b/Sources/InclusiveColorTools/InclusiveColorTools.swift index fdffd6f..34159c7 100644 --- a/Sources/InclusiveColorTools/InclusiveColorTools.swift +++ b/Sources/InclusiveColorTools/InclusiveColorTools.swift @@ -31,10 +31,6 @@ public struct InclusiveColorTools { // MARK: - TOOLS - /// Free-to-use color blindness-friendly color palettes, with annotations, citations, and license notes. Please consider contributing and providing feedback if palettes need additional usage flags. - /// - public static let palettes = ICPalettes.self - /// General-purpose simulator of color perception. You may use this singleton instance or initialize a custom simulator that replaces the default transformations. /// public static private(set) var simulator: ICVisionSimulator = { ICVisionSimulator_Machado.default }() diff --git a/Sources/InclusiveColorTools/Models/SRGBA/IC_SRGBA.swift b/Sources/InclusiveColorTools/Models/SRGBA/IC_SRGBA.swift index ad949e8..88473c2 100644 --- a/Sources/InclusiveColorTools/Models/SRGBA/IC_SRGBA.swift +++ b/Sources/InclusiveColorTools/Models/SRGBA/IC_SRGBA.swift @@ -8,7 +8,7 @@ import Foundation /// public struct ICSRGBA { public var rgb: sRGBColor - public let a: UnmutatedAlpha + public var a: UnmutatedAlpha } -extension ICSRGBA: Hashable, Equatable {} +extension ICSRGBA: Hashable, Equatable, Codable {} diff --git a/Sources/InclusiveColorTools/Models/_Helpers/GammaEncodingDecoding.swift b/Sources/InclusiveColorTools/Models/_Helpers/GammaEncodingDecoding.swift index 49b9ae7..67383c5 100644 --- a/Sources/InclusiveColorTools/Models/_Helpers/GammaEncodingDecoding.swift +++ b/Sources/InclusiveColorTools/Models/_Helpers/GammaEncodingDecoding.swift @@ -62,3 +62,4 @@ extension ICColorChannel { static let k_416x: ICColorChannel = 0.41666666666 } } + diff --git a/Sources/InclusiveColorTools/Palettes/AllieOfisher/AllieOfisher.swift b/Sources/InclusiveColorTools/Palettes/AllieOfisher/AllieOfisher.swift deleted file mode 100644 index 05258ea..0000000 --- a/Sources/InclusiveColorTools/Palettes/AllieOfisher/AllieOfisher.swift +++ /dev/null @@ -1,128 +0,0 @@ -import Foundation - -public extension ICPalettes { - struct AllieOfisher { - internal static var author: String = { "Allie Ofisher" }() - internal static var license: String = { "Awaiting Response" }() - internal static var licenseCopy: String = { "Unclear, designed while at Cafe Pixo" }() - internal static var link: URL = { URL(string: "https://medium.com/cafe-pixo/inclusive-color-palettes-for-the-web-bbfe8cf2410e")! }() - } -} - -public extension ICPalettes.AllieOfisher { - - struct SixPalette1: AccessiblePalette { - - public let title = "Six #1" - - public let description = "Six-color palette distinguishable in an artistically appealing manner" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.AllieOfisher.author - public let license = ICPalettes.AllieOfisher.license - public let licenseCopy = ICPalettes.AllieOfisher.licenseCopy - public let link = ICPalettes.AllieOfisher.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case navy - case blue - case greyPurple - case red - case lime - case yellowGreen - - public var srgba: ICSRGBA { - switch self { - case .navy: return ICSRGBA(232, 240, 134) - case .blue: return ICSRGBA(111, 222, 110) - case .greyPurple: return ICSRGBA(255, 66, 66) - case .red: return ICSRGBA(166, 145, 174) - case .lime: return ICSRGBA(35, 95, 164) - case .yellowGreen: return ICSRGBA(10, 40, 75) - } - } - } - } - - struct SixPalette2: AccessiblePalette { - - public let title = "Six #2" - - public let description = "Six-color palette distinguishable in an artistically appealing manner" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.AllieOfisher.author - public let license = ICPalettes.AllieOfisher.license - public let licenseCopy = ICPalettes.AllieOfisher.licenseCopy - public let link = ICPalettes.AllieOfisher.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case armyGreen - case grayMedium - case gold - case purple - case red - case grayDark - - public var srgba: ICSRGBA { - switch self { - case .armyGreen: return ICSRGBA(189, 217, 191) - case .grayMedium: return ICSRGBA(146, 144, 132) - case .gold: return ICSRGBA(255, 200, 87) - case .purple: return ICSRGBA(169, 151, 223) - case .red: return ICSRGBA(229, 50, 59) - case .grayDark: return ICSRGBA(46, 64, 82) - } - } - } - } - - struct SixPalette3: AccessiblePalette { - - public let title = "Six #3" - - public let description = "Six-color palette distinguishable in an artistically appealing manner" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.AllieOfisher.author - public let license = ICPalettes.AllieOfisher.license - public let licenseCopy = ICPalettes.AllieOfisher.licenseCopy - public let link = ICPalettes.AllieOfisher.link - - public var id: String { title + author } - - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case yellowPale - case orange - case red - case blue - case grayMedium - case grayDark - - public var srgba: ICSRGBA { - switch self { - case .yellowPale: return ICSRGBA(225, 218, 174) - case .orange: return ICSRGBA(255, 147, 79) - case .red: return ICSRGBA(204, 45, 53) - case .blue: return ICSRGBA(5, 142, 217) - case .grayMedium: return ICSRGBA(132, 143, 162) - case .grayDark: return ICSRGBA(45, 49, 66) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Diverging.swift b/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Diverging.swift deleted file mode 100644 index 2adbfd7..0000000 --- a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Diverging.swift +++ /dev/null @@ -1,183 +0,0 @@ -import Foundation - -extension ICPalettes.BrewerHarrower.Diverging { - - struct BrownGreen: AccessiblePalette { - - public let title = "Brown Green" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .divergingData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Orange - case color1YellowOrange - case color2Gray - case color3CyanGreen - case color4CyanGreen - - public var srgba: ICSRGBA { - switch self { - case .color0Orange: return ICSRGBA(166, 97, 26) - case .color1YellowOrange: return ICSRGBA(223, 194, 125) - case .color2Gray: return ICSRGBA(245, 245, 245) - case .color3CyanGreen: return ICSRGBA(128, 205, 193) - case .color4CyanGreen: return ICSRGBA( 1, 133, 113) - } - } - } - } - - struct PinkYellowGreen: AccessiblePalette { - - public let title = "Pink Yellow Green" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .divergingData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Scarlet - case color1Scarlet - case color2Gray - case color3YellowGreen - case color4GreenSapling - - public var srgba: ICSRGBA { - switch self { - case .color0Scarlet: return ICSRGBA(208, 28, 139) - case .color1Scarlet: return ICSRGBA(241, 182, 218) - case .color2Gray: return ICSRGBA(247, 247, 247) - case .color3YellowGreen: return ICSRGBA(184, 225, 134) - case .color4GreenSapling: return ICSRGBA( 77, 172, 38) - - } - } - } - } - - struct PurpleGreen: AccessiblePalette { - - public let title = "Purple Green" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .divergingData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleMagenta - case color1PurpleMagenta - case color2Gray - case color3Green - case color4GreenishBlue - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleMagenta: return ICSRGBA(123, 50, 148) - case .color1PurpleMagenta: return ICSRGBA(194, 165, 207) - case .color2Gray: return ICSRGBA(247, 247, 147) - case .color3Green: return ICSRGBA(166, 219, 160) - case .color4GreenishBlue: return ICSRGBA( 0, 136, 55) - } - - } - } - } - - struct PurpleOrange: AccessiblePalette { - - public let title = "Purple Orange" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .divergingData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1PurpleViolet - case color2Gray - case color3Orange - case color4RedOrange - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 94, 60, 153) - case .color1PurpleViolet: return ICSRGBA(178, 171, 210) - case .color2Gray: return ICSRGBA(247, 247, 247) - case .color3Orange: return ICSRGBA(253, 184, 99) - case .color4RedOrange: return ICSRGBA(230, 97, 1) - - } - } - } - } - - struct RedBlue: AccessiblePalette { - - public let title = "Red Blue" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .divergingData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0ScarletRed - case color1RedOrange - case color2Gray - case color3BluishCyan - case color4BluishCyan - - public var srgba: ICSRGBA { - switch self { - case .color0ScarletRed: return ICSRGBA(202, 0, 32) - case .color1RedOrange: return ICSRGBA(244, 165, 130) - case .color2Gray: return ICSRGBA(247, 247, 247) - case .color3BluishCyan: return ICSRGBA(146, 197, 222) - case .color4BluishCyan: return ICSRGBA( 5, 113, 176) - } - } - } - } -} - diff --git a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Sequential.swift b/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Sequential.swift deleted file mode 100644 index 3260180..0000000 --- a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+Sequential.swift +++ /dev/null @@ -1,216 +0,0 @@ -import Foundation - -extension ICPalettes.BrewerHarrower.Sequential { - - struct Reds: AccessiblePalette { - - public let title = "Reds" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0RedOrange - case color1RedOrange - case color2RedOrange - case color3Red - case color4Red - - public var srgba: ICSRGBA { - switch self { - case .color0RedOrange: return ICSRGBA(254, 229, 217) - case .color1RedOrange: return ICSRGBA(252, 174, 144) - case .color2RedOrange: return ICSRGBA(250, 105, 73) - case .color3Red: return ICSRGBA(222, 45, 37) - case .color4Red: return ICSRGBA(165, 21, 21) - } - } - } - } - - struct Blues: AccessiblePalette { - - public let title = "Blues" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1BluishCyan - case color2BluishCyan - case color3Blue - case color4Blue - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA(238, 242, 254) - case .color1BluishCyan: return ICSRGBA(189, 215, 231) - case .color2BluishCyan: return ICSRGBA(106, 173, 214) - case .color3Blue: return ICSRGBA( 49, 130, 189) - case .color4Blue: return ICSRGBA( 8, 81, 156) - } - } - } - } - - struct Greens: AccessiblePalette { - - public let title = "Greens" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0GreenSapling - case color1GreenSapling - case color2Green - case color3GreenishBlue - case color4Turquoise - - public var srgba: ICSRGBA { - switch self { - case .color0GreenSapling: return ICSRGBA(237, 248, 233) - case .color1GreenSapling: return ICSRGBA(186, 228, 179) - case .color2Green: return ICSRGBA(116, 196, 118) - case .color3GreenishBlue: return ICSRGBA( 48, 163, 84) - case .color4Turquoise: return ICSRGBA( 0, 109, 44) - } - } - } - } - - struct Grays: AccessiblePalette { - - public let title = "Grays" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Gray - case color1Gray - case color2Gray - case color3Gray - case color4Gray - - public var srgba: ICSRGBA { - switch self { - case .color0Gray: return ICSRGBA(247, 247, 247) - case .color1Gray: return ICSRGBA(204, 204, 204) - case .color2Gray: return ICSRGBA(150, 150, 150) - case .color3Gray: return ICSRGBA( 99, 99, 99) - case .color4Gray: return ICSRGBA( 37, 37, 37) - } - } - } - - } - - struct Oranges: AccessiblePalette { - - public let title = "Oranges" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Orange - case color1Orange - case color2Orange - case color3RedOrange - case color4RedOrange - - public var srgba: ICSRGBA { - switch self { - case .color0Orange: return ICSRGBA(254, 237, 222) - case .color1Orange: return ICSRGBA(253, 190, 133) - case .color2Orange: return ICSRGBA(253, 140, 60) - case .color3RedOrange: return ICSRGBA(230, 85, 13) - case .color4RedOrange: return ICSRGBA(166, 54, 3) - } - } - - } - } - - struct Purples: AccessiblePalette { - - public let title = "Purples" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Gray - case color1Violet - case color2Violet - case color3PurpleViolet - case color4Purple - - public var srgba: ICSRGBA { - switch self { - case .color0Gray: return ICSRGBA(242, 240, 247) - case .color1Violet: return ICSRGBA(203, 201, 226) - case .color2Violet: return ICSRGBA(158, 154, 200) - case .color3PurpleViolet: return ICSRGBA(117, 107, 177) - case .color4Purple: return ICSRGBA( 84, 39, 143) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+SequentialMultihue.swift b/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+SequentialMultihue.swift deleted file mode 100644 index cbab97e..0000000 --- a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower+SequentialMultihue.swift +++ /dev/null @@ -1,250 +0,0 @@ -import Foundation - -extension ICPalettes.BrewerHarrower.Sequential { - - struct BluePurple: AccessiblePalette { - - public let title = "Blue Purple" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BluishCyan - case color1Blue - case color2BlueViolet - case color3Purple - case color4Purple - - public var srgba: ICSRGBA { - switch self { - case .color0BluishCyan: return ICSRGBA(237, 248, 251) - case .color1Blue: return ICSRGBA(179, 205, 227) - case .color2BlueViolet: return ICSRGBA(140, 150, 198) - case .color3Purple: return ICSRGBA(136, 87, 167) - case .color4Purple: return ICSRGBA(129, 15, 124) - } - } - } - } - - struct OrangeRed: AccessiblePalette { - - public let title = "Orange Red" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Orange - case color1Orange - case color2RedOrange - case color3Red - case color4Red - - public var srgba: ICSRGBA { - switch self { - case .color0Orange: return ICSRGBA(254, 240, 217) - case .color1Orange: return ICSRGBA(253, 204, 138) - case .color2RedOrange: return ICSRGBA(252, 141, 89) - case .color3Red: return ICSRGBA(227, 74, 51) - case .color4Red: return ICSRGBA(179, 0, 0) - } - } - } - } - - struct PurpleBlue: AccessiblePalette { - - public let title = "Purple Blue" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Purple - case color1BlueViolet - case color2Blue - case color3BluishCyan - case color4BluishCyan - - public var srgba: ICSRGBA { - switch self { - case .color0Purple: return ICSRGBA(241, 238, 246) - case .color1BlueViolet: return ICSRGBA(189, 201, 225) - case .color2Blue: return ICSRGBA(116, 169, 207) - case .color3BluishCyan: return ICSRGBA( 43, 140, 190) - case .color4BluishCyan: return ICSRGBA( 4, 90, 141) - } - } - } - } - - - struct RedPurple: AccessiblePalette { - - public let title = "Red Purple" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0RedOrange - case color1Red - case color2ScarletRed - case color3Scarlet - case color4Purple - - public var srgba: ICSRGBA { - switch self { - case .color0RedOrange: return ICSRGBA(254, 235, 226) - case .color1Red: return ICSRGBA(251, 180, 185) - case .color2ScarletRed: return ICSRGBA(247, 104, 161) - case .color3Scarlet: return ICSRGBA(197, 27, 138) - case .color4Purple: return ICSRGBA(122, 1, 119) - } - } - } - } - - struct YellowGreenBlue: AccessiblePalette { - - public let title = "Yellow Green Blue" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Yellow - case color1GreenishBlue - case color2Cyan - case color3Blue - case color4BlueViolet - - public var srgba: ICSRGBA { - switch self { - case .color0Yellow: return ICSRGBA(255, 255, 204) - case .color1GreenishBlue: return ICSRGBA(161, 218, 180) - case .color2Cyan: return ICSRGBA( 65, 182, 196) - case .color3Blue: return ICSRGBA( 44, 127, 184) - case .color4BlueViolet: return ICSRGBA( 37, 52, 148) - } - } - } - } - - struct YellowOrangeBrown: AccessiblePalette { - - public let title = "Yellow Orange Brown" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Yellow - case color1YellowOrange - case color2Orange - case color3RedOrange - case color4RedOrange - - public var srgba: ICSRGBA { - switch self { - case .color0Yellow: return ICSRGBA(255, 255, 212) - case .color1YellowOrange: return ICSRGBA(254, 217, 142) - case .color2Orange: return ICSRGBA(254, 153, 41) - case .color3RedOrange: return ICSRGBA(217, 95, 14) - case .color4RedOrange: return ICSRGBA(153, 52, 4) - } - } - } - } - - struct YellowOrangeRed: AccessiblePalette { - - public let title = "Yellow Orange Red" - - public let description = ICPalettes.BrewerHarrower.description - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.BrewerHarrower.author - public let license = ICPalettes.BrewerHarrower.license - public let licenseCopy = ICPalettes.BrewerHarrower.licenseCopy - public let link = ICPalettes.BrewerHarrower.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Yellow - case color1YellowOrange - case color2RedOrange - case color3Red - case color4ScarletRed - - public var srgba: ICSRGBA { - switch self { - case .color0Yellow: return ICSRGBA(255, 254, 178) - case .color1YellowOrange: return ICSRGBA(254, 204, 92) - case .color2RedOrange: return ICSRGBA(253, 141, 60) - case .color3Red: return ICSRGBA(240, 59, 32) - case .color4ScarletRed: return ICSRGBA(189, 0, 38) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower.swift b/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower.swift deleted file mode 100644 index 84a260e..0000000 --- a/Sources/InclusiveColorTools/Palettes/BrewerHarrower/BrewerHarrower.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation - -public extension ICPalettes { - - /// Colors by Cynthia A. Brewer and Mark Harrower, Pennsylvania State University [Website](http://www.ColorBrewer.org) - /// - struct BrewerHarrower { - - public struct Sequential {} - public struct Diverging {} - - internal static var author: String = { "Cynthia Brewer and Mark Harrower" }() - internal static var link: URL = { URL(string: "http://www.ColorBrewer.org")! }() - internal static var description: String = { "Pennsylvania State University professor of geography Cynthia Brewer developed many palettes for cartography. Map designs require colors to be differentiable when not sequentially ordered and in complex patterns. Her color schemes were screened for colorblind readers by Steve Gardner in his masters thesis." }() - internal static var license: String = { "Apache V2" }() - internal static var licenseCopy: String = { """ -Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes - -Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. - -Permission is hereby granted, free of charge, to any person ob- taining a copy of this software and associated documentation files (the ”Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ”AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" + LicensesForAccessiblePalettes.apache2 - }() - } -} - diff --git a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Cameri+Diverging.swift b/Sources/InclusiveColorTools/Palettes/FabioCrameri/Cameri+Diverging.swift deleted file mode 100644 index fb5a542..0000000 --- a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Cameri+Diverging.swift +++ /dev/null @@ -1,412 +0,0 @@ -import Foundation - -public extension ICPalettes.FabioCrameri.Diverging { - - struct Broc: AccessiblePalette { - - public let title = "Broc" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba } } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1BlueViolet - case color2Blue - case color3Blue - case color4Blue - case color5Yellow - case color6Yellow - case color7Yellow - case color8Yellow - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 43, 25, 76) - case .color1BlueViolet: return ICSRGBA( 40, 68, 118) - case .color2Blue: return ICSRGBA( 75, 117, 160) - case .color3Blue: return ICSRGBA(138, 166, 194) - case .color4Blue: return ICSRGBA(205, 217, 228) - case .color5Yellow: return ICSRGBA(232, 232, 209) - case .color6Yellow: return ICSRGBA(196, 196, 142) - case .color7Yellow: return ICSRGBA(141, 141, 85) - case .color8Yellow: return ICSRGBA( 85, 85, 39) - case .color9Yellow: return ICSRGBA( 38, 38, 0) - } - } - } - } - - - struct Cork: AccessiblePalette { - - public let title = "Cork" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1BlueViolet - case color2Blue - case color3Blue - case color4Blue - case color5Green - case color6Green - case color7Green - case color8Green - case color9GreenSapling - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 43, 25, 76) - case .color1BlueViolet: return ICSRGBA( 39, 68, 119) - case .color2Blue: return ICSRGBA( 72, 116, 158) - case .color3Blue: return ICSRGBA(130, 160, 189) - case .color4Blue: return ICSRGBA(202, 215, 227) - case .color5Green: return ICSRGBA(209, 224, 209) - case .color6Green: return ICSRGBA(141, 179, 141) - case .color7Green: return ICSRGBA( 78, 137, 78) - case .color8Green: return ICSRGBA( 27, 91, 24) - case .color9GreenSapling: return ICSRGBA( 15, 40, 3) - } - } - } - } - - struct Vik: AccessiblePalette { - - public let title = "Vik" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2BluishCyan - case color3BluishCyan - case color4BluishCyan - case color5RedOrange - case color6RedOrange - case color7RedOrange - case color8RedOrange - case color9Red - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 0, 17, 96) - case .color1Blue: return ICSRGBA( 2, 61, 124) - case .color2BluishCyan: return ICSRGBA( 30, 111, 157) - case .color3BluishCyan: return ICSRGBA(112, 168, 195) - case .color4BluishCyan: return ICSRGBA(201, 221, 230) - case .color5RedOrange: return ICSRGBA(234, 205, 189) - case .color6RedOrange: return ICSRGBA(211, 151, 116) - case .color7RedOrange: return ICSRGBA(189, 101, 51) - case .color8RedOrange: return ICSRGBA(139, 39, 5) - case .color9Red: return ICSRGBA( 89, 0, 7) - } - } - } - } - - - struct Lisbon: AccessiblePalette { - - public let title = "Lisbon" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Violet - case color1BlueViolet - case color2Blue - case color3Blue - case color4Blue - case color5Yellow - case color6YellowOrange - case color7YellowOrange - case color8Yellow - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0Violet: return ICSRGBA(229, 229, 254) - case .color1BlueViolet: return ICSRGBA(154, 174, 210) - case .color2Blue: return ICSRGBA( 81, 119, 163) - case .color3Blue: return ICSRGBA( 29, 67, 104) - case .color4Blue: return ICSRGBA( 17, 29, 43) - case .color5Yellow: return ICSRGBA( 38, 37, 25) - case .color6YellowOrange: return ICSRGBA( 86, 81, 51) - case .color7YellowOrange: return ICSRGBA(141, 133, 86) - case .color8Yellow: return ICSRGBA(200, 194, 144) - case .color9Yellow: return ICSRGBA(254, 254, 216) - } - } - } - } - - struct Tofino: AccessiblePalette { - - public let title = "Tofino" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1BlueViolet - case color2BlueViolet - case color3BlueViolet - case color4Blue - case color5Green - case color6Green - case color7Green - case color8GreenSapling - case color9LemonRipening - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA(221, 216, 254) - case .color1BlueViolet: return ICSRGBA(146, 164, 222) - case .color2BlueViolet: return ICSRGBA( 74, 107, 172) - case .color3BlueViolet: return ICSRGBA( 39, 60, 100) - case .color4Blue: return ICSRGBA( 17, 25, 38) - case .color5Green: return ICSRGBA( 17, 34, 19) - case .color6Green: return ICSRGBA( 36, 77, 40) - case .color7Green: return ICSRGBA( 63, 128, 67) - case .color8GreenSapling: return ICSRGBA(135, 185, 111) - case .color9LemonRipening: return ICSRGBA(219, 229, 155) - } - } - } - } - - struct Berlin: AccessiblePalette { - - public let title = "Berlin" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2BluishCyan - case color3BluishCyan - case color4Blue - case color5RedOrange - case color6RedOrange - case color7RedOrange - case color8Red - case color9Red - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA(158, 175, 254) - case .color1Blue: return ICSRGBA( 90, 163, 218) - case .color2BluishCyan: return ICSRGBA( 45, 116, 150) - case .color3BluishCyan: return ICSRGBA( 25, 66, 85) - case .color4Blue: return ICSRGBA( 16, 24, 29) - case .color5RedOrange: return ICSRGBA( 40, 13, 0) - case .color6RedOrange: return ICSRGBA( 80, 23, 3) - case .color7RedOrange: return ICSRGBA(138, 62, 41) - case .color8Red: return ICSRGBA(196, 117, 106) - case .color9Red: return ICSRGBA(254, 173, 173) - } - } - } - } - - - struct Roma: AccessiblePalette { - - public let title = "Roma" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0RedOrange - case color1Orange - case color2YellowOrange - case color3YellowOrange - case color4LemonRipening - case color5CyanGreen - case color6BluishCyan - case color7BluishCyan - case color8Blue - case color9BlueViolet - - public var srgba: ICSRGBA { - switch self { - case .color0RedOrange: return ICSRGBA(125, 23, 0) - case .color1Orange: return ICSRGBA(153, 81, 21) - case .color2YellowOrange: return ICSRGBA(176, 128, 42) - case .color3YellowOrange: return ICSRGBA(200, 180, 85) - case .color4LemonRipening: return ICSRGBA(208, 226, 163) - case .color5CyanGreen: return ICSRGBA(164, 229, 211) - case .color6BluishCyan: return ICSRGBA( 93, 192, 211) - case .color7BluishCyan: return ICSRGBA( 50, 145, 193) - case .color8Blue: return ICSRGBA( 32, 99, 174) - case .color9BlueViolet: return ICSRGBA( 2, 48, 152) - } - } - } - } - - struct Bam: AccessiblePalette { - - public let title = "Bam" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Crimson - case color1Crimson - case color2Crimson - case color3Crimson - case color4Crimson - case color5LemonRipening - case color6YellowGreen - case color7YellowGreen - case color8GreenSapling - case color9GreenSapling - - public var srgba: ICSRGBA { - switch self { - case .color0Crimson: return ICSRGBA(101, 2, 75) - case .color1Crimson: return ICSRGBA(158, 59, 132) - case .color2Crimson: return ICSRGBA(200, 111, 177) - case .color3Crimson: return ICSRGBA(228, 174, 214) - case .color4Crimson: return ICSRGBA(244, 227, 239) - case .color5LemonRipening: return ICSRGBA(238, 242, 228) - case .color6YellowGreen: return ICSRGBA(193, 217, 161) - case .color7YellowGreen: return ICSRGBA(124, 168, 86) - case .color8GreenSapling: return ICSRGBA( 69, 122, 42) - case .color9GreenSapling: return ICSRGBA( 12, 75, 0) - } - } - } - } - - struct Vanimo: AccessiblePalette { - - public let title = "Vanimo" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.divergingData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Magenta - case color1Crimson - case color2Crimson - case color3Crimson - case color4Scarlet - case color5LemonRipening - case color6YellowGreen - case color7YellowGreen - case color8YellowGreen - case color9GreenSapling - - public var srgba: ICSRGBA { - switch self { - case .color0Magenta: return ICSRGBA(255, 204, 252) - case .color1Crimson: return ICSRGBA(211, 129, 196) - case .color2Crimson: return ICSRGBA(161, 73, 142) - case .color3Crimson: return ICSRGBA( 91, 36, 79) - case .color4Scarlet: return ICSRGBA( 34, 19, 28) - case .color5LemonRipening: return ICSRGBA( 27, 29, 17) - case .color6YellowGreen: return ICSRGBA( 53, 73, 26) - case .color7YellowGreen: return ICSRGBA( 91, 126, 45) - case .color8YellowGreen: return ICSRGBA(132, 181, 76) - case .color9GreenSapling: return ICSRGBA(189, 252, 165) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Cyclic.swift b/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Cyclic.swift deleted file mode 100644 index c8b8385..0000000 --- a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Cyclic.swift +++ /dev/null @@ -1,222 +0,0 @@ -import Foundation - -public extension ICPalettes.FabioCrameri.Cyclic { - - - struct RomaO: AccessiblePalette { - - public let title = "RomaO" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.cyclicalData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Red - case color1Orange - case color2YellowOrange - case color3Yellow - case color4Turquoise - case color5BluishCyan - case color6Blue - case color7PurpleViolet - case color8Scarlet - - public var srgba: ICSRGBA { - switch self { - case .color0Red: return ICSRGBA(135, 64, 55) - case .color1Orange: return ICSRGBA(163, 103, 44) - case .color2YellowOrange: return ICSRGBA(195, 163, 75) - case .color3Yellow: return ICSRGBA(214, 216, 147) - case .color4Turquoise: return ICSRGBA(180, 222, 198) - case .color5BluishCyan: return ICSRGBA(116, 187, 205) - case .color6Blue: return ICSRGBA( 79, 136, 185) - case .color7PurpleViolet: return ICSRGBA( 92, 83, 139) - case .color8Scarlet: return ICSRGBA(115, 57, 87) - } - } - } - } - - struct BamO: AccessiblePalette { - - public let title = "BamO" - - public let description = ICPalettes.FabioCrameri.sharedDescription - - public let tags: [ICPaletteUtilityTag] = [.cyclicalData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Crimson - case color1Crimson - case color2Crimson - case color3ScarletRed - case color4LemonRipening - case color5LemonRipening - case color6LemonRipening - case color7Orange - case color8Scarlet - - public var srgba: ICSRGBA { - switch self { - case .color0Crimson: return ICSRGBA(118, 61, 105) - case .color1Crimson: return ICSRGBA(176, 110, 160) - case .color2Crimson: return ICSRGBA(211, 162, 196) - case .color3ScarletRed: return ICSRGBA(218, 198, 204) - case .color4LemonRipening: return ICSRGBA(196, 202, 173) - case .color5LemonRipening: return ICSRGBA(146, 161, 115) - case .color6LemonRipening: return ICSRGBA(103, 110, 77) - case .color7Orange: return ICSRGBA( 77, 68, 59) - case .color8Scarlet: return ICSRGBA( 76, 46, 64) - } - } - } - } - - struct BrocO: AccessiblePalette { - - public let title = "BrocO" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.cyclicalData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2Blue - case color3BluishCyan - case color4Yellow - case color5Yellow - case color6Yellow - case color7YellowOrange - case color8Magenta - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 56, 65, 100) - case .color1Blue: return ICSRGBA( 85, 114, 154) - case .color2Blue: return ICSRGBA(138, 163, 191) - case .color3BluishCyan: return ICSRGBA(193, 204, 208) - case .color4Yellow: return ICSRGBA(202, 203, 171) - case .color5Yellow: return ICSRGBA(158, 158, 108) - case .color6Yellow: return ICSRGBA(107, 105, 61) - case .color7YellowOrange: return ICSRGBA( 68, 63, 41) - case .color8Magenta: return ICSRGBA( 55, 47, 56) - } - } - } - } - - - struct CorkO: AccessiblePalette { - - public let title = "CorkO" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.cyclicalData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2Blue - case color3BluishCyan - case color4GreenishBlue - case color5Green - case color6GreenSapling - case color7LemonRipening - case color8YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 54, 60, 81) - case .color1Blue: return ICSRGBA( 73, 99, 135) - case .color2Blue: return ICSRGBA(120, 148, 176) - case .color3BluishCyan: return ICSRGBA(164, 188, 192) - case .color4GreenishBlue: return ICSRGBA(152, 188, 158) - case .color5Green: return ICSRGBA(106, 152, 103) - case .color6GreenSapling: return ICSRGBA( 71, 103, 55) - case .color7LemonRipening: return ICSRGBA( 59, 69, 41) - case .color8YellowOrange: return ICSRGBA( 55, 54, 51) - } - } - } - } - - struct VikO: AccessiblePalette { - - public let title = "VikO" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.cyclicalData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2Blue - case color3BluishCyan - case color4GreenishBlue - case color5Green - case color6GreenSapling - case color7LemonRipening - case color8YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 62, 68, 93) - case .color1Blue: return ICSRGBA( 84, 110, 148) - case .color2Blue: return ICSRGBA(132, 158, 186) - case .color3BluishCyan: return ICSRGBA(173, 196, 200) - case .color4GreenishBlue: return ICSRGBA(161, 196, 166) - case .color5Green: return ICSRGBA(115, 163, 111) - case .color6GreenSapling: return ICSRGBA( 79, 115, 59) - case .color7LemonRipening: return ICSRGBA( 67, 79, 44) - case .color8YellowOrange: return ICSRGBA( 63, 62, 58) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+MultiSequential.swift b/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+MultiSequential.swift deleted file mode 100644 index f5a0204..0000000 --- a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+MultiSequential.swift +++ /dev/null @@ -1,139 +0,0 @@ -import Foundation - -public extension ICPalettes.FabioCrameri.Multisequential { - - struct Oleron: AccessiblePalette { - - public let title = "Oleron" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.multisequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case seriesA_0BlueViolet - case seriesA_1BlueViolet - case seriesA_2BlueViolet - case seriesA_3BlueViolet - case seriesA_4BlueViolet - case seriesB_5LemonRipening - case seriesB_6Yellow - case seriesB_7YellowOrange - case seriesB_8Orange - case seriesB_9Yellow - - public var srgba: ICSRGBA { - switch self { - case .seriesA_0BlueViolet: return ICSRGBA( 25, 38, 89) - case .seriesA_1BlueViolet: return ICSRGBA( 69, 81, 133) - case .seriesA_2BlueViolet: return ICSRGBA(118, 131, 182) - case .seriesA_3BlueViolet: return ICSRGBA(169, 182, 231) - case .seriesA_4BlueViolet: return ICSRGBA(210, 223, 250) - case .seriesB_5LemonRipening: return ICSRGBA( 59, 86, 0) - case .seriesB_6Yellow: return ICSRGBA(121, 113, 30) - case .seriesB_7YellowOrange: return ICSRGBA(183, 154, 94) - case .seriesB_8Orange: return ICSRGBA(240, 206, 164) - case .seriesB_9Yellow: return ICSRGBA(252, 252, 229) - } - } - } - } - - struct Bukavu: AccessiblePalette { - - public let title = "Bukavu" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.multisequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case seriesA_0Cyan - case seriesA_1Blue - case seriesA_2Blue - case seriesA_3BluishCyan - case seriesA_4CyanGreen - case seriesB_5Green - case seriesB_6LemonRipening - case seriesB_7Brown - case seriesB_8Orange - case seriesB_9Violet - - public var srgba: ICSRGBA { - switch self { - case .seriesA_0Cyan: return ICSRGBA( 25, 51, 51) - case .seriesA_1Blue: return ICSRGBA( 33, 80, 119) - case .seriesA_2Blue: return ICSRGBA( 51, 132, 194) - case .seriesA_3BluishCyan: return ICSRGBA(102, 180, 202) - case .seriesA_4CyanGreen: return ICSRGBA(178, 229, 216) - case .seriesB_5Green: return ICSRGBA( 18, 82, 23) - case .seriesB_6LemonRipening: return ICSRGBA(105, 115, 40) - case .seriesB_7Brown: return ICSRGBA(169, 132, 79) - case .seriesB_8Orange: return ICSRGBA(210, 193, 169) - case .seriesB_9Violet: return ICSRGBA(237, 236, 252) - } - } - } - } - - struct Fes: AccessiblePalette { - - public let title = "Fes" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.multisequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case seriesA_0Gray - case seriesA_1Gray - case seriesA_2Gray - case seriesA_3Gray - case seriesA_4Gray - case seriesB_5GreenSapling - case seriesB_6YellowOrange - case seriesB_7Orange - case seriesB_8Orange - case seriesB_9Violet - - public var srgba: ICSRGBA { - switch self { - case .seriesA_0Gray: return ICSRGBA( 12, 12, 12) - case .seriesA_1Gray: return ICSRGBA( 63, 63, 63) - case .seriesA_2Gray: return ICSRGBA(108, 108, 108) - case .seriesA_3Gray: return ICSRGBA(150, 150, 150) - case .seriesA_4Gray: return ICSRGBA(206, 206, 206) - case .seriesB_5GreenSapling: return ICSRGBA( 45, 79, 31) - case .seriesB_6YellowOrange: return ICSRGBA(117, 99, 42) - case .seriesB_7Orange: return ICSRGBA(182, 130, 76) - case .seriesB_8Orange: return ICSRGBA(211, 194, 169) - case .seriesB_9Violet: return ICSRGBA(237, 236, 251) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Sequential.swift b/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Sequential.swift deleted file mode 100644 index e948174..0000000 --- a/Sources/InclusiveColorTools/Palettes/FabioCrameri/Crameri+Sequential.swift +++ /dev/null @@ -1,815 +0,0 @@ -import Foundation - -public extension ICPalettes.FabioCrameri.Sequential { - - struct Batlow: AccessiblePalette { - - public let title = "Batlow" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2BluishCyan - case color3Turquoise - case color4LemonRipening - case color5YellowOrange - case color6Orange - case color7RedOrange - case color8Red - case color9Magenta - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 0, 25, 89) - case .color1Blue: return ICSRGBA( 13, 54, 94) - case .color2BluishCyan: return ICSRGBA( 28, 85, 96) - case .color3Turquoise: return ICSRGBA( 62, 108, 84) - case .color4LemonRipening: return ICSRGBA(104, 122, 62) - case .color5YellowOrange: return ICSRGBA(155, 136, 45) - case .color6Orange: return ICSRGBA(212, 148, 71) - case .color7RedOrange: return ICSRGBA(248, 162, 128) - case .color8Red: return ICSRGBA(253, 183, 189) - case .color9Magenta: return ICSRGBA(250, 204, 250) - } - } - } - } - - struct BatlowW: AccessiblePalette { - - public let title = "BatlowW" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1Blue - case color2Cyan - case color3Turquoise - case color4YellowGreen - case color5Yellow - case color6Orange - case color7RedOrange - case color8Red - case color9White - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 1, 25, 89) - case .color1Blue: return ICSRGBA( 16, 62, 95) - case .color2Cyan: return ICSRGBA( 26, 89, 98) - case .color3Turquoise: return ICSRGBA( 56, 109, 88) - case .color4YellowGreen: return ICSRGBA(100, 126, 66) - case .color5Yellow: return ICSRGBA(153, 144, 50) - case .color6Orange: return ICSRGBA(207, 162, 90) - case .color7RedOrange: return ICSRGBA(237, 175, 145) - case .color8Red: return ICSRGBA(254, 216, 213) - case .color9White: return ICSRGBA(255, 253, 253) - } - } - } - } - - struct BatlowK: AccessiblePalette { - - public let title = "BatlowK" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1BluishCyan - case color2Cyan - case color3YellowGreen - case color4Yellow - case color5YellowOrange - case color6Orange - case color7RedOrange - case color8ScarletRed - case color9Magenta - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 2, 3, 5) - case .color1BluishCyan: return ICSRGBA( 23, 45, 54) - case .color2Cyan: return ICSRGBA( 52, 82, 81) - case .color3YellowGreen: return ICSRGBA( 83, 100, 72) - case .color4Yellow: return ICSRGBA(119, 118, 56) - case .color5YellowOrange: return ICSRGBA(169, 136, 51) - case .color6Orange: return ICSRGBA(218, 150, 82) - case .color7RedOrange: return ICSRGBA(247, 165, 137) - case .color8ScarletRed: return ICSRGBA(253, 184, 193) - case .color9Magenta: return ICSRGBA(250, 204, 250) - } - } - } - } - - struct Devon: AccessiblePalette { - - public let title = "Devon" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1BlueViolet - case color2Blue - case color3Blue - case color4BlueViolet - case color5Violet - case color6Violet - case color7Violet - case color8Violet - case color9White - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 43, 25, 76) - case .color1BlueViolet: return ICSRGBA( 41, 51, 102) - case .color2Blue: return ICSRGBA( 39, 80, 133) - case .color3Blue: return ICSRGBA( 53, 104, 172) - case .color4BlueViolet: return ICSRGBA( 96, 129, 208) - case .color5Violet: return ICSRGBA(151, 154, 230) - case .color6Violet: return ICSRGBA(185, 179, 240) - case .color7Violet: return ICSRGBA(207, 203, 245) - case .color8Violet: return ICSRGBA(231, 229, 250) - case .color9White: return ICSRGBA(254, 254, 254) - } - } - } - } - - struct LaJolla: AccessiblePalette { - - public let title = "LaJolla" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Yellow - case color1YellowOrange - case color2YellowOrange - case color3Orange - case color4RedOrange - case color5RedOrange - case color6Red - case color7RedOrange - case color8Orange - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0Yellow: return ICSRGBA(254, 254, 203) - case .color1YellowOrange: return ICSRGBA(251, 235, 153) - case .color2YellowOrange: return ICSRGBA(243, 204, 103) - case .color3Orange: return ICSRGBA(235, 167, 84) - case .color4RedOrange: return ICSRGBA(228, 134, 80) - case .color5RedOrange: return ICSRGBA(209, 98, 76) - case .color6Red: return ICSRGBA(164, 70, 66) - case .color7RedOrange: return ICSRGBA(114, 55, 46) - case .color8Orange: return ICSRGBA( 66, 40, 24) - case .color9Yellow: return ICSRGBA( 25, 25, 0) - } - } - } - } - - struct Bamako: AccessiblePalette { - - public let title = "Bamako" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BluishCyan - case color1CyanGreen - case color2GreenishBlue - case color3GreenSapling - case color4YellowGreen - case color5LemonRipening - case color6Yellow - case color7YellowOrange - case color8YellowOrange - case color9YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0BluishCyan: return ICSRGBA( 0, 63, 76) - case .color1CyanGreen: return ICSRGBA( 18, 74, 66) - case .color2GreenishBlue: return ICSRGBA( 37, 87, 54) - case .color3GreenSapling: return ICSRGBA( 58, 100, 42) - case .color4YellowGreen: return ICSRGBA( 81, 116, 28) - case .color5LemonRipening: return ICSRGBA(113, 135, 10) - case .color6Yellow: return ICSRGBA(150, 145, 6) - case .color7YellowOrange: return ICSRGBA(196, 173, 49) - case .color8YellowOrange: return ICSRGBA(230, 204, 104) - case .color9YellowOrange: return ICSRGBA(254, 229, 152) - } - } - } - } - - struct Davos: AccessiblePalette { - - public let title = "Davos" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Violet - case color1BlueViolet - case color2Blue - case color3Blue - case color4BluishCyan - case color5CyanGreen - case color6YellowGreen - case color7LemonRipening - case color8Yellow - case color9White - - public var srgba: ICSRGBA { - switch self { - case .color0Violet: return ICSRGBA( 0, 5, 74) - case .color1BlueViolet: return ICSRGBA( 17, 44, 113) - case .color2Blue: return ICSRGBA( 40, 81, 145) - case .color3Blue: return ICSRGBA( 67, 111, 157) - case .color4BluishCyan: return ICSRGBA( 94, 132, 152) - case .color5CyanGreen: return ICSRGBA(121, 150, 141) - case .color6YellowGreen: return ICSRGBA(152, 172, 135) - case .color7LemonRipening: return ICSRGBA(200, 209, 157) - case .color8Yellow: return ICSRGBA(242, 243, 210) - case .color9White: return ICSRGBA(254, 254, 254) - } - } - } - } - - struct Bilbao: AccessiblePalette { - - public let title = "Bilbao" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0White - case color1Gray - case color2YellowOrange - case color3YellowOrange - case color4Orange - case color5RedOrange - case color6RedOrange - case color7Red - case color8Red - case color9Red - - public var srgba: ICSRGBA { - switch self { - case .color0White: return ICSRGBA(255, 255, 254) - case .color1Gray: return ICSRGBA(219, 219, 216) - case .color2YellowOrange: return ICSRGBA(196, 192, 175) - case .color3YellowOrange: return ICSRGBA(185, 174, 138) - case .color4Orange: return ICSRGBA(174, 148, 108) - case .color5RedOrange: return ICSRGBA(166, 122, 96) - case .color6RedOrange: return ICSRGBA(158, 97, 84) - case .color7Red: return ICSRGBA(141, 68, 65) - case .color8Red: return ICSRGBA(110, 34, 34) - case .color9Red: return ICSRGBA( 76, 0, 1) - } - } - } - } - - struct Nuuk: AccessiblePalette { - - public let title = "Nuuk" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Blue - case color1BluishCyan - case color2BluishCyan - case color3BluishCyan - case color4Turquoise - case color5Yellow - case color6Yellow - case color7Yellow - case color8Yellow - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0Blue: return ICSRGBA( 4, 89, 140) - case .color1BluishCyan: return ICSRGBA( 41, 98, 131) - case .color2BluishCyan: return ICSRGBA( 74, 113, 131) - case .color3BluishCyan: return ICSRGBA(110, 134, 140) - case .color4Turquoise: return ICSRGBA(145, 155, 150) - case .color5Yellow: return ICSRGBA(171, 173, 149) - case .color6Yellow: return ICSRGBA(185, 185, 140) - case .color7Yellow: return ICSRGBA(198, 198, 131) - case .color8Yellow: return ICSRGBA(224, 223, 141) - case .color9Yellow: return ICSRGBA(254, 254, 179) - } - } - } - } - - struct Oslo: AccessiblePalette { - - public let title = "Oslo" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Green - case color1Blue - case color2Blue - case color3Blue - case color4Blue - case color5Blue - case color6BlueViolet - case color7BlueViolet - case color8Blue - case color9White - - public var srgba: ICSRGBA { - switch self { - case .color0Green: return ICSRGBA( 0, 1, 0) - case .color1Blue: return ICSRGBA( 13, 26, 41) - case .color2Blue: return ICSRGBA( 19, 50, 80) - case .color3Blue: return ICSRGBA( 30, 76, 123) - case .color4Blue: return ICSRGBA( 56, 104, 167) - case .color5Blue: return ICSRGBA(101, 138, 198) - case .color6BlueViolet: return ICSRGBA(136, 160, 201) - case .color7BlueViolet: return ICSRGBA(170, 182, 202) - case .color8Blue: return ICSRGBA(211, 214, 218) - case .color9White: return ICSRGBA(254, 255, 254) - } - } - } - } - - struct GrayC: AccessiblePalette { - - public let title = "GrayC" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0White - case color1Gray - case color2Gray - case color3Gray - case color4Gray - case color5Gray - case color6Gray - case color7Gray - case color8Gray - case color9Black - - public var srgba: ICSRGBA { - switch self { - case .color0White: return ICSRGBA(254, 254, 254) - case .color1Gray: return ICSRGBA(223, 223, 223) - case .color2Gray: return ICSRGBA(191, 191, 191) - case .color3Gray: return ICSRGBA(162, 162, 162) - case .color4Gray: return ICSRGBA(133, 133, 133) - case .color5Gray: return ICSRGBA(104, 104, 104) - case .color6Gray: return ICSRGBA( 78, 78, 78) - case .color7Gray: return ICSRGBA( 53, 53, 53) - case .color8Gray: return ICSRGBA( 29, 29, 29) - case .color9Black: return ICSRGBA( 0, 0, 0) - } - } - } - } - - struct Hawaii: AccessiblePalette { - - public let title = "Hawaii" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Purple - case color1Scarlet - case color2Red - case color3Brown - case color4YellowOrange - case color5LemonRipening - case color6GreenSapling - case color7Turquoise - case color8CyanGreen - case color9BluishCyan - - public var srgba: ICSRGBA { - switch self { - case .color0Purple: return ICSRGBA(140, 1, 115) - case .color1Scarlet: return ICSRGBA(145, 42, 88) - case .color2Red: return ICSRGBA(149, 70, 66) - case .color3Brown: return ICSRGBA(153, 98, 47) - case .color4YellowOrange: return ICSRGBA(156, 130, 30) - case .color5LemonRipening: return ICSRGBA(150, 168, 41) - case .color6GreenSapling: return ICSRGBA(127, 196, 94) - case .color7Turquoise: return ICSRGBA(101, 216, 155) - case .color8CyanGreen: return ICSRGBA(107, 234, 218) - case .color9BluishCyan: return ICSRGBA(179, 241, 253) - } - } - } - } - - struct Lapaz: AccessiblePalette { - - public let title = "Lapaz" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1Violet - case color2BlueViolet - case color3Blue - case color4Blue - case color5BluishCyan - case color6GreenishBlue - case color7YellowOrange - case color8Orange - case color9Red - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 26, 12, 100) - case .color1Violet: return ICSRGBA( 34, 45, 122) - case .color2BlueViolet: return ICSRGBA( 42, 75, 142) - case .color3Blue: return ICSRGBA( 53, 103, 156) - case .color4Blue: return ICSRGBA( 75, 128, 163) - case .color5BluishCyan: return ICSRGBA(109, 149, 160) - case .color6GreenishBlue: return ICSRGBA(147, 162, 151) - case .color7YellowOrange: return ICSRGBA(191, 177, 152) - case .color8Orange: return ICSRGBA(238, 210, 192) - case .color9Red: return ICSRGBA(254, 242, 242) - } - } - } - } - - struct Tokyo: AccessiblePalette { - - public let title = "Tokyo" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1PurpleMagenta - case color2Purple - case color3Crimson - case color4Scarlet - case color5LemonRipening - case color6GreenSapling - case color7GreenSapling - case color8YellowGreen - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 26, 14, 51) - case .color1PurpleMagenta: return ICSRGBA( 68, 31, 76) - case .color2Purple: return ICSRGBA(110, 62, 102) - case .color3Crimson: return ICSRGBA(132, 94, 120) - case .color4Scarlet: return ICSRGBA(140, 121, 129) - case .color5LemonRipening: return ICSRGBA(145, 147, 137) - case .color6GreenSapling: return ICSRGBA(151, 174, 144) - case .color7GreenSapling: return ICSRGBA(166, 205, 157) - case .color8YellowGreen: return ICSRGBA(213, 241, 188) - case .color9Yellow: return ICSRGBA(254, 254, 216) - } - } - } - } - - struct Buda: AccessiblePalette { - - public let title = "Buda" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Magenta - case color1Crimson - case color2Crimson - case color3Scarlet - case color4Red - case color5RedOrange - case color6Orange - case color7YellowOrange - case color8Yellow - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0Magenta: return ICSRGBA(178, 0, 178) - case .color1Crimson: return ICSRGBA(178, 42, 158) - case .color2Crimson: return ICSRGBA(185, 71, 146) - case .color3Scarlet: return ICSRGBA(193, 96, 137) - case .color4Red: return ICSRGBA(201, 120, 129) - case .color5RedOrange: return ICSRGBA(208, 145, 123) - case .color6Orange: return ICSRGBA(214, 169, 116) - case .color7YellowOrange: return ICSRGBA(220, 195, 110) - case .color8Yellow: return ICSRGBA(229, 222, 104) - case .color9Yellow: return ICSRGBA(255, 255, 102) - } - } - } - } - - struct Acton: AccessiblePalette { - - public let title = "Acton" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0PurpleViolet - case color1Purple - case color2Purple - case color3Purple - case color4Scarlet - case color5Scarlet - case color6Scarlet - case color7Crimson - case color8Magenta - case color9Violet - - public var srgba: ICSRGBA { - switch self { - case .color0PurpleViolet: return ICSRGBA( 46, 33, 76) - case .color1Purple: return ICSRGBA( 75, 58, 102) - case .color2Purple: return ICSRGBA(110, 84, 128) - case .color3Purple: return ICSRGBA(146, 99, 144) - case .color4Scarlet: return ICSRGBA(177, 103, 149) - case .color5Scarlet: return ICSRGBA(208, 123, 165) - case .color6Scarlet: return ICSRGBA(212, 148, 183) - case .color7Crimson: return ICSRGBA(212, 172, 200) - case .color8Magenta: return ICSRGBA(219, 200, 220) - case .color9Violet: return ICSRGBA(229, 229, 239) - } - } - } - } - - struct Turku: AccessiblePalette { - - public let title = "Turku" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Black - case color1Yellow - case color2Yellow - case color3Yellow - case color4Yellow - case color5YellowOrange - case color6Orange - case color7RedOrange - case color8Red - case color9Red - - public var srgba: ICSRGBA { - switch self { - case .color0Black: return ICSRGBA( 0, 0, 0) - case .color1Yellow: return ICSRGBA( 35, 35, 32) - case .color2Yellow: return ICSRGBA( 66, 66, 53) - case .color3Yellow: return ICSRGBA( 95, 94, 68) - case .color4Yellow: return ICSRGBA(126, 123, 81) - case .color5YellowOrange: return ICSRGBA(168, 152, 101) - case .color6Orange: return ICSRGBA(207, 165, 123) - case .color7RedOrange: return ICSRGBA(234, 173, 152) - case .color8Red: return ICSRGBA(251, 199, 194) - case .color9Red: return ICSRGBA(255, 229, 229) - } - } - } - } - - struct Imola: AccessiblePalette { - - public let title = "Imola" - - public let description = ICPalettes.FabioCrameri.sharedDescription - public let tags: [ICPaletteUtilityTag] = [.sequentialData, .quantitative] - - public let author = ICPalettes.FabioCrameri.author - public let license = ICPalettes.FabioCrameri.license - public let licenseCopy = ICPalettes.FabioCrameri.licenseCopy - public let link = ICPalettes.FabioCrameri.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0BlueViolet - case color1BlueViolet - case color2Blue - case color3Blue - case color4BluishCyan - case color5Turquoise - case color6Green - case color7YellowGreen - case color8LemonRipening - case color9Yellow - - public var srgba: ICSRGBA { - switch self { - case .color0BlueViolet: return ICSRGBA( 25, 51, 178) - case .color1BlueViolet: return ICSRGBA( 36, 70, 168) - case .color2Blue: return ICSRGBA( 45, 89, 159) - case .color3Blue: return ICSRGBA( 57, 106, 147) - case .color4BluishCyan: return ICSRGBA( 72, 123, 133) - case .color5Turquoise: return ICSRGBA( 96, 146, 122) - case .color6Green: return ICSRGBA(122, 173, 116) - case .color7YellowGreen: return ICSRGBA(152, 202, 108) - case .color8LemonRipening: return ICSRGBA(196, 233, 102) - case .color9Yellow: return ICSRGBA(255, 254, 102) - } - } - } - } - -} diff --git a/Sources/InclusiveColorTools/Palettes/FabioCrameri/FabioCrameri.swift b/Sources/InclusiveColorTools/Palettes/FabioCrameri/FabioCrameri.swift deleted file mode 100644 index 972c479..0000000 --- a/Sources/InclusiveColorTools/Palettes/FabioCrameri/FabioCrameri.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation - -public extension ICPalettes { - - /// Suite of scientific, color-vision deficiency friendly and perceptually uniform color maps - /// - /// Scientific color maps v 7.0 release date 2021 February 2. [Zenodo archive](https://zenodo.org/record/4491293#.YCv6ai1h1zU) - /// - struct FabioCrameri { - - public struct Sequential {} - public struct Diverging {} - public struct Multisequential {} - public struct Cyclic {} - - internal static var author: String = { "Fabio Crameri" }() - internal static let link: URL = { URL(string: "http://www.fabiocrameri.ch/colourmaps.php")! }() - internal static var license: String = { "MIT License" }() - internal static var licenseCopy: String = { """ -Copyright (c) 2021, Fabio Crameri - -Permission is hereby granted, free of charge, to any person ob- taining a copy of this software and associated documentation files (the ”Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ”AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - }() - - internal static var sharedDescription: String = { "Fabio's scientific color maps are perceptually uniform to portray linear data without visual distortions, which are common for rainbow-based schemes. His maps work well in black and white presentation. For continuous plots or finer interpolations, use Fabio's python repo." }() - } -} - diff --git a/Sources/InclusiveColorTools/Palettes/IBM/IBM.swift b/Sources/InclusiveColorTools/Palettes/IBM/IBM.swift deleted file mode 100644 index 72a380a..0000000 --- a/Sources/InclusiveColorTools/Palettes/IBM/IBM.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation - -public extension ICPalettes { - struct IBM { } -} - -public extension ICPalettes.IBM { - - struct DataVisStarter: AccessiblePalette { - - public let title = "Data Vis Starter" - - public let description = "IBM Design Language Color Library" - - public let author = "IBM" - public let license = "CC-BY-4.0" - public var licenseCopy = { - """ -Copyright IBM Corporation 2017. IBM Design Colors by International Business Machines Corporation is licensed under a Creative Commons Attribution 4.0 International License. - Based on a work at https://github.com/IBM-Design/colors. -""" + LicensesForAccessiblePalettes.ccby4 - }() - public let link = URL(string: "https://web.archive.org/web/20180808011442/https://www.ibm.com/design/language/resources/color-library/")! - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case ultramarina40 - case indigo50 - case magenta50 - case orange40 - case gold20 - - public var srgba: ICSRGBA { - switch self { - case .ultramarina40: return ICSRGBA(100, 143, 255) - case .indigo50: return ICSRGBA(120, 94, 240) - case .magenta50: return ICSRGBA(220, 38, 127) - case .orange40: return ICSRGBA(254, 97, 0) - case .gold20: return ICSRGBA(255, 176, 0) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/ICPalettes.swift b/Sources/InclusiveColorTools/Palettes/ICPalettes.swift deleted file mode 100644 index f572315..0000000 --- a/Sources/InclusiveColorTools/Palettes/ICPalettes.swift +++ /dev/null @@ -1,249 +0,0 @@ -import Foundation - -/// These published color blindness-friendly palettes are free, with licenses for inclusion in your app. A visual browser is available on the Mac App Store as "Inclusive Color". -/// -public struct ICPalettes { - - /// These published color blindness-friendly palettes are free, with licenses for inclusion in your app. A visual browser is available on the Mac App Store as "Inclusive Color". - /// - public enum AllPalettes: CaseIterable, Identifiable { - case AllieOfisher_SixPalette1 - case AllieOfisher_SixPalette2 - case AllieOfisher_SixPalette3 - case BrewerHarrower_Diverging_BrownGreen - case BrewerHarrower_Diverging_PinkYellowGreen - case BrewerHarrower_Diverging_PurpleGreen - case BrewerHarrower_Diverging_PurpleOrange - case BrewerHarrower_Diverging_RedBlue - case BrewerHarrower_Sequential_Reds - case BrewerHarrower_Sequential_Blues - case BrewerHarrower_Sequential_Greens - case BrewerHarrower_Sequential_Grays - case BrewerHarrower_Sequential_Oranges - case BrewerHarrower_Sequential_Purples - case BrewerHarrower_Sequential_BluePurple - case BrewerHarrower_Sequential_OrangeRed - case BrewerHarrower_Sequential_PurpleBlue - case BrewerHarrower_Sequential_RedPurple - case BrewerHarrower_Sequential_YellowGreenBlue - case BrewerHarrower_Sequential_YellowOrangeBrown - case BrewerHarrower_Sequential_YellowOrangeRed - case FabioCrameri_Cyclic_RomaO - case FabioCrameri_Cyclic_BamO - case FabioCrameri_Cyclic_BrocO - case FabioCrameri_Cyclic_CorkO - case FabioCrameri_Cyclic_VikO - case FabioCrameri_Diverging_Broc - case FabioCrameri_Diverging_Cork - case FabioCrameri_Diverging_Vik - case FabioCrameri_Diverging_Lisbon - case FabioCrameri_Diverging_Tofino - case FabioCrameri_Diverging_Berlin - case FabioCrameri_Diverging_Roma - case FabioCrameri_Diverging_Bam - case FabioCrameri_Diverging_Vanimo - case FabioCrameri_Multisequential_Oleron - case FabioCrameri_Multisequential_Bukavu - case FabioCrameri_Multisequential_Fes - case FabioCrameri_Sequential_Batlow - case FabioCrameri_Sequential_BatlowW - case FabioCrameri_Sequential_BatlowK - case FabioCrameri_Sequential_Devon - case FabioCrameri_Sequential_LaJolla - case FabioCrameri_Sequential_Bamako - case FabioCrameri_Sequential_Davos - case FabioCrameri_Sequential_Bilbao - case FabioCrameri_Sequential_Nuuk - case FabioCrameri_Sequential_Oslo - case FabioCrameri_Sequential_GrayC - case FabioCrameri_Sequential_Hawaii - case FabioCrameri_Sequential_Lapaz - case FabioCrameri_Sequential_Tokyo - case FabioCrameri_Sequential_Buda - case FabioCrameri_Sequential_Acton - case FabioCrameri_Sequential_Turku - case FabioCrameri_Sequential_Imola - case IBMDataVisStarter - case JamieNunez_Cividis5 - case JamieNunez_Cividis6 - case JamieNunez_Cividis10 - case MasatakaOkabeKeiIto_Qualitative - case PaulTol_Diverging_Sunset - case PaulTol_Diverging_BuRd - case PaulTol_Diverging_PRGn - case PaulTol_Qualitative_Bright - case PaulTol_Qualitative_HighContrast - case PaulTol_Qualitative_Vibrant - case PaulTol_Qualitative_Muted - case PaulTol_Qualitative_PaleTextBackground - case PaulTol_Qualitative_DarkText - case PaulTol_Qualitative_Light - case PaulTol_Sequential_DiscreteRainbow14 - case PaulTol_Sequential_DiscreteRainbow23 - case PaulTol_Sequential_SmoothRainbow34 - case PaulTol_Sequential_Iridescent23 - case PaulTol_Sequential_YellowOrBrown9 - - public var title: String { reference.title } - public var description: String { reference.description } - public var tags: [ICPaletteUtilityTag] { reference.tags } - public var author: String { reference.author } - public var license: String { reference.license } - public var licenseCopy: String { reference.licenseCopy } - public var link: URL { reference.link } - - /// Some color sets, such as Paul Tol's Discrete Rainbow, have a higher source color count than the maximum number of differentiable colors. Those color sets have functions to generate usable subsets of the palette. - /// - public var colorCount: Int { reference.colorCount } - - /// Formed by String(title + author + colorCount) - /// - public var id: String { - switch self { - case .PaulTol_Sequential_DiscreteRainbow14: - return reference.id + "14" - - case .PaulTol_Sequential_DiscreteRainbow23: - return reference.id + "23" - - default: return reference.id + String(reference.colorCount) - } - } - - /// Color set expressed as a framework-internal sRGBA object. Versions for UIKit, AppKit, and SwiftUI are also provided. - /// - public var colors_SRGBA: [ICSRGBA] { - switch self { - - case .PaulTol_Sequential_DiscreteRainbow14: - return ICPalettes.PaulTol.SequentialData.DiscreteRainbow_UseMakeRainbowFunc.recommendedRainbow14 - - case .PaulTol_Sequential_DiscreteRainbow23: - return ICPalettes.PaulTol.SequentialData.DiscreteRainbow_UseMakeRainbowFunc.recommendedRainbow23 - - default: return reference.srgba - } - } - - private var reference: AccessiblePalette { - switch self { - case .AllieOfisher_SixPalette1: - return ICPalettes.AllieOfisher.SixPalette1() - - case .AllieOfisher_SixPalette2: - return ICPalettes.AllieOfisher.SixPalette2() - - case .AllieOfisher_SixPalette3: - return ICPalettes.AllieOfisher.SixPalette3() - - case .IBMDataVisStarter: - return ICPalettes.IBM.DataVisStarter() - - case .MasatakaOkabeKeiIto_Qualitative: - return ICPalettes.MasatakaOkabeKeiIto.Vivid() - - case .PaulTol_Diverging_Sunset: - return ICPalettes.PaulTol.DivergingData.Sunset() - - case .PaulTol_Diverging_BuRd: - return ICPalettes.PaulTol.DivergingData.BuRd() - - case .PaulTol_Diverging_PRGn: - return ICPalettes.PaulTol.DivergingData.PRGn() - - case .PaulTol_Qualitative_Bright: - return ICPalettes.PaulTol.QualitativeData.Bright() - - case .PaulTol_Qualitative_HighContrast: - return ICPalettes.PaulTol.QualitativeData.HighContrast() - - case .PaulTol_Qualitative_Vibrant: - return ICPalettes.PaulTol.QualitativeData.Vibrant() - - case .PaulTol_Qualitative_Muted: - return ICPalettes.PaulTol.QualitativeData.Muted() - - case .PaulTol_Qualitative_PaleTextBackground: - return ICPalettes.PaulTol.QualitativeData.PaleTextBackground() - - case .PaulTol_Qualitative_DarkText: - return ICPalettes.PaulTol.QualitativeData.DarkText() - - case .PaulTol_Qualitative_Light: - return ICPalettes.PaulTol.QualitativeData.Light() - - case .PaulTol_Sequential_DiscreteRainbow14: - return ICPalettes.PaulTol.SequentialData.DiscreteRainbow_UseMakeRainbowFunc() - - case .PaulTol_Sequential_DiscreteRainbow23: - return ICPalettes.PaulTol.SequentialData.DiscreteRainbow_UseMakeRainbowFunc() - - case .PaulTol_Sequential_SmoothRainbow34: - return ICPalettes.PaulTol.SequentialData.SmoothLinearInterpolationRainbow() - - case .PaulTol_Sequential_Iridescent23: - return ICPalettes.PaulTol.SequentialData.Iridescent() - - case .PaulTol_Sequential_YellowOrBrown9: - return ICPalettes.PaulTol.SequentialData.YellowOrBrown() - - case .BrewerHarrower_Diverging_BrownGreen: return ICPalettes.BrewerHarrower.Diverging.BrownGreen() - case .BrewerHarrower_Diverging_PinkYellowGreen: return ICPalettes.BrewerHarrower.Diverging.PinkYellowGreen() - case .BrewerHarrower_Diverging_PurpleGreen: return ICPalettes.BrewerHarrower.Diverging.PurpleGreen() - case .BrewerHarrower_Diverging_PurpleOrange: return ICPalettes.BrewerHarrower.Diverging.PurpleOrange() - case .BrewerHarrower_Diverging_RedBlue: return ICPalettes.BrewerHarrower.Diverging.RedBlue() - case .BrewerHarrower_Sequential_Reds: return ICPalettes.BrewerHarrower.Sequential.Reds() - case .BrewerHarrower_Sequential_Blues: return ICPalettes.BrewerHarrower.Sequential.Blues() - case .BrewerHarrower_Sequential_Greens: return ICPalettes.BrewerHarrower.Sequential.Greens() - case .BrewerHarrower_Sequential_Grays: return ICPalettes.BrewerHarrower.Sequential.Grays() - case .BrewerHarrower_Sequential_Oranges: return ICPalettes.BrewerHarrower.Sequential.Oranges() - case .BrewerHarrower_Sequential_Purples: return ICPalettes.BrewerHarrower.Sequential.Purples() - case .BrewerHarrower_Sequential_BluePurple: return ICPalettes.BrewerHarrower.Sequential.BluePurple() - case .BrewerHarrower_Sequential_OrangeRed: return ICPalettes.BrewerHarrower.Sequential.OrangeRed() - case .BrewerHarrower_Sequential_PurpleBlue: return ICPalettes.BrewerHarrower.Sequential.PurpleBlue() - case .BrewerHarrower_Sequential_RedPurple: return ICPalettes.BrewerHarrower.Sequential.RedPurple() - case .BrewerHarrower_Sequential_YellowGreenBlue: return ICPalettes.BrewerHarrower.Sequential.YellowGreenBlue() - case .BrewerHarrower_Sequential_YellowOrangeBrown: return ICPalettes.BrewerHarrower.Sequential.YellowOrangeBrown() - case .BrewerHarrower_Sequential_YellowOrangeRed: return ICPalettes.BrewerHarrower.Sequential.YellowOrangeRed() - case .FabioCrameri_Cyclic_RomaO: return ICPalettes.FabioCrameri.Cyclic.RomaO() - case .FabioCrameri_Cyclic_BamO: return ICPalettes.FabioCrameri.Cyclic.BamO() - case .FabioCrameri_Cyclic_BrocO: return ICPalettes.FabioCrameri.Cyclic.BrocO() - case .FabioCrameri_Cyclic_CorkO: return ICPalettes.FabioCrameri.Cyclic.CorkO() - case .FabioCrameri_Cyclic_VikO: return ICPalettes.FabioCrameri.Cyclic.VikO() - case .FabioCrameri_Diverging_Broc: return ICPalettes.FabioCrameri.Diverging.Broc() - case .FabioCrameri_Diverging_Cork: return ICPalettes.FabioCrameri.Diverging.Cork() - case .FabioCrameri_Diverging_Vik: return ICPalettes.FabioCrameri.Diverging.Vik() - case .FabioCrameri_Diverging_Lisbon: return ICPalettes.FabioCrameri.Diverging.Lisbon() - case .FabioCrameri_Diverging_Tofino: return ICPalettes.FabioCrameri.Diverging.Tofino() - case .FabioCrameri_Diverging_Berlin: return ICPalettes.FabioCrameri.Diverging.Berlin() - case .FabioCrameri_Diverging_Roma: return ICPalettes.FabioCrameri.Diverging.Roma() - case .FabioCrameri_Diverging_Bam: return ICPalettes.FabioCrameri.Diverging.Bam() - case .FabioCrameri_Diverging_Vanimo: return ICPalettes.FabioCrameri.Diverging.Vanimo() - case .FabioCrameri_Multisequential_Oleron: return ICPalettes.FabioCrameri.Multisequential.Oleron() - case .FabioCrameri_Multisequential_Bukavu: return ICPalettes.FabioCrameri.Multisequential.Bukavu() - case .FabioCrameri_Multisequential_Fes: return ICPalettes.FabioCrameri.Multisequential.Fes() - case .FabioCrameri_Sequential_Batlow: return ICPalettes.FabioCrameri.Sequential.Batlow() - case .FabioCrameri_Sequential_BatlowW: return ICPalettes.FabioCrameri.Sequential.BatlowW() - case .FabioCrameri_Sequential_BatlowK: return ICPalettes.FabioCrameri.Sequential.BatlowK() - case .FabioCrameri_Sequential_Devon: return ICPalettes.FabioCrameri.Sequential.Devon() - case .FabioCrameri_Sequential_LaJolla: return ICPalettes.FabioCrameri.Sequential.LaJolla() - case .FabioCrameri_Sequential_Bamako: return ICPalettes.FabioCrameri.Sequential.Bamako() - case .FabioCrameri_Sequential_Davos: return ICPalettes.FabioCrameri.Sequential.Davos() - case .FabioCrameri_Sequential_Bilbao: return ICPalettes.FabioCrameri.Sequential.Bilbao() - case .FabioCrameri_Sequential_Nuuk: return ICPalettes.FabioCrameri.Sequential.Nuuk() - case .FabioCrameri_Sequential_Oslo: return ICPalettes.FabioCrameri.Sequential.Oslo() - case .FabioCrameri_Sequential_GrayC: return ICPalettes.FabioCrameri.Sequential.GrayC() - case .FabioCrameri_Sequential_Hawaii: return ICPalettes.FabioCrameri.Sequential.Hawaii() - case .FabioCrameri_Sequential_Lapaz: return ICPalettes.FabioCrameri.Sequential.Lapaz() - case .FabioCrameri_Sequential_Tokyo: return ICPalettes.FabioCrameri.Sequential.Tokyo() - case .FabioCrameri_Sequential_Buda: return ICPalettes.FabioCrameri.Sequential.Buda() - case .FabioCrameri_Sequential_Acton: return ICPalettes.FabioCrameri.Sequential.Acton() - case .FabioCrameri_Sequential_Turku: return ICPalettes.FabioCrameri.Sequential.Turku() - case .FabioCrameri_Sequential_Imola: return ICPalettes.FabioCrameri.Sequential.Imola() - case .JamieNunez_Cividis5: return ICPalettes.JamieNunezEtAl.Sequential.Cividis5Step() - case .JamieNunez_Cividis6: return ICPalettes.JamieNunezEtAl.Sequential.Cividis6Step() - case .JamieNunez_Cividis10: return ICPalettes.JamieNunezEtAl.Sequential.Cividis10Step() - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/JamieNunez/Nunez+Cividis.swift b/Sources/InclusiveColorTools/Palettes/JamieNunez/Nunez+Cividis.swift deleted file mode 100644 index 771c536..0000000 --- a/Sources/InclusiveColorTools/Palettes/JamieNunez/Nunez+Cividis.swift +++ /dev/null @@ -1,175 +0,0 @@ -import Foundation - -public extension ICPalettes { - - /// Jamie Nuñez, Christpher Anderton, and Ryan Renslow developed cividis as a refinement of the matplotlib viridis scheme for uniform CVD perception. - /// - /// [PLOS ONE 2018](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239) - /// - struct JamieNunezEtAl { - - public struct Sequential {} - - internal static var author: String = { "Jamie Nuñez, Christpher Anderton, Ryan Renslow" }() - internal static var link: URL = { URL(string: "https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239")! }() - internal static var license: String = { "Free with citation from Battelle Memorial Institute" }() - internal static var licenseCopy: String = { - """ -Copyright (c) 2017, Battelle Memorial Institute - -1. Battelle Memorial Institute (hereinafter Battelle) hereby grants -permission to any person or entity lawfully obtaining a copy of this software -and associated documentation files (hereinafter “the Software”) to -redistribute and use the Software in source and binary forms, with or without -modification. Such person or entity may use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and may permit -others to do so, subject to the following conditions: - -+ Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimers. - -+ Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -+ Other than as used herein, neither the name Battelle Memorial Institute or -Battelle may be used in any form whatsoever without the express written -consent of Battelle. - -2. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL BATTELLE OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -""" - }() - internal static var cividisDescription: String = { "Cividis refines the matplotlib viridis scheme for uniform CVD perception. See the R library cmaputil or colorspacious for finer interpolations." }() - } -} - -extension ICPalettes.JamieNunezEtAl.Sequential { - - struct Cividis5Step: AccessiblePalette { - - public let title = "Cividis 5-Step" - - public let description = ICPalettes.JamieNunezEtAl.cividisDescription - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.JamieNunezEtAl.author - public let license = ICPalettes.JamieNunezEtAl.license - public let licenseCopy = ICPalettes.JamieNunezEtAl.licenseCopy - public let link = ICPalettes.JamieNunezEtAl.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Blue - case color1BlueViolet - case color2YellowOrange - case color3YellowOrange - case color4YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0Blue: return ICSRGBA( 0, 32, 76) - case .color1BlueViolet: return ICSRGBA( 64, 76, 107) - case .color2YellowOrange: return ICSRGBA(123, 122, 119) - case .color3YellowOrange: return ICSRGBA(186, 172, 111) - case .color4YellowOrange: return ICSRGBA(255, 230, 66) - } - } - } - } - - struct Cividis6Step: AccessiblePalette { - - public let title = "Cividis 6-Step" - - public let description = ICPalettes.JamieNunezEtAl.cividisDescription - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.JamieNunezEtAl.author - public let license = ICPalettes.JamieNunezEtAl.license - public let licenseCopy = ICPalettes.JamieNunezEtAl.licenseCopy - public let link = ICPalettes.JamieNunezEtAl.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Blue - case color1BlueViolet - case color2BlueViolet - case color3YellowOrange - case color4YellowOrange - case color5YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0Blue: return ICSRGBA( 0, 32, 78) - case .color1BlueViolet: return ICSRGBA( 49, 68, 107) - case .color2BlueViolet: return ICSRGBA(101, 103, 111) - case .color3YellowOrange: return ICSRGBA(147, 141, 120) - case .color4YellowOrange: return ICSRGBA(199, 183, 106) - case .color5YellowOrange: return ICSRGBA(255, 229, 66) - } - } - } - } - - struct Cividis10Step: AccessiblePalette { - - public let title = "Cividis 10-Step" - - public let description = ICPalettes.JamieNunezEtAl.cividisDescription - public let tags: [ICPaletteUtilityTag] = [.quantitative, .sequentialData] - - public let author = ICPalettes.JamieNunezEtAl.author - public let license = ICPalettes.JamieNunezEtAl.license - public let licenseCopy = ICPalettes.JamieNunezEtAl.licenseCopy - public let link = ICPalettes.JamieNunezEtAl.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Blue - case color1Blue - case color2BlueViolet - case color3BlueViolet - case color4Gray - case color5YellowOrange - case color6YellowOrange - case color7YellowOrange - case color8YellowOrange - case color9YellowOrange - - public var srgba: ICSRGBA { - switch self { - case .color0Blue: return ICSRGBA( 0, 32, 76) - case .color1Blue: return ICSRGBA( 0, 51, 110) - case .color2BlueViolet: return ICSRGBA( 55, 71, 107) - case .color3BlueViolet: return ICSRGBA( 85, 91, 108) - case .color4Gray: return ICSRGBA(111, 111, 114) - case .color5YellowOrange: return ICSRGBA(136, 133, 120) - case .color6YellowOrange: return ICSRGBA(164, 155, 117) - case .color7YellowOrange: return ICSRGBA(193, 178, 108) - case .color8YellowOrange: return ICSRGBA(224, 203, 93) - case .color9YellowOrange: return ICSRGBA(255, 230, 66) - } - } - } - } - - -} diff --git a/Sources/InclusiveColorTools/Palettes/Licenses.swift b/Sources/InclusiveColorTools/Palettes/Licenses.swift deleted file mode 100644 index eac30f6..0000000 --- a/Sources/InclusiveColorTools/Palettes/Licenses.swift +++ /dev/null @@ -1,163 +0,0 @@ -import Foundation - -/// See each palette for licenses. This is a bank of recurring license text. Yes, it is "pointless" to have this as a lazy variable, but the companion macOS app will browse palettes and copy license text to the clipboard on command. -/// -public struct LicensesForAccessiblePalettes { - - public static var ccby4 = { """ -Creative Commons Attribution 4.0 International Public License - -By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. - -Section 1 – Definitions. - -Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. -Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. -Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. -Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. -Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. -Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. -Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. -Licensor means the individual(s) or entity(ies) granting rights under this Public License. -Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. -Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. -You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. - -Section 2 – Scope. - -License grant. -Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: -reproduce and Share the Licensed Material, in whole or in part; and -produce, reproduce, and Share Adapted Material. -Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. -Term. The term of this Public License is specified in Section 6(a). -Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. -Downstream recipients. -Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. -No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. -No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). -Other rights. - -Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. -Patent and trademark rights are not licensed under this Public License. -To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. - -Section 3 – License Conditions. - -Your exercise of the Licensed Rights is expressly made subject to the following conditions. - -Attribution. - -If You Share the Licensed Material (including in modified form), You must: - -retain the following if it is supplied by the Licensor with the Licensed Material: -identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); -a copyright notice; -a notice that refers to this Public License; -a notice that refers to the disclaimer of warranties; -a URI or hyperlink to the Licensed Material to the extent reasonably practicable; -indicate if You modified the Licensed Material and retain an indication of any previous modifications; and -indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. -You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. -If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. -If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License. -Section 4 – Sui Generis Database Rights. - -Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: - -for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; -if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and -You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. -For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. - -Section 5 – Disclaimer of Warranties and Limitation of Liability. - -Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. -To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. -The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. - -Section 6 – Term and Termination. - -This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. -Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: - -automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or -upon express reinstatement by the Licensor. -For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. -For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. -Sections 1, 5, 6, 7, and 8 survive termination of this Public License. - -Section 7 – Other Terms and Conditions. - -The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. -Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. - -Section 8 – Interpretation. - -For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. -To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. -No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. -Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. -Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. - -Creative Commons may be contacted at creativecommons.org. -""" - }() - - public static var apache2 = { - """ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and -You must cause any modified files to carry prominent notices stating that You changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. - -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS -""" }() -} diff --git a/Sources/InclusiveColorTools/Palettes/MasatakaOkabe/MasatakaOkabe.swift b/Sources/InclusiveColorTools/Palettes/MasatakaOkabe/MasatakaOkabe.swift deleted file mode 100644 index fe04b51..0000000 --- a/Sources/InclusiveColorTools/Palettes/MasatakaOkabe/MasatakaOkabe.swift +++ /dev/null @@ -1,50 +0,0 @@ -import Foundation - -public extension ICPalettes { - struct MasatakaOkabeKeiIto { } -} - -public extension ICPalettes.MasatakaOkabeKeiIto { - - struct Vivid: AccessiblePalette { - - public let title = "Vivid" - - public let description = "The use of this palette is supported by others (Wong, 2011; Levine, 2009) and it is the default scale for the book “Fundamentals of Data Visualization” by Claus Wilke. Republished in Nature Methods by Bang Wong. (doi.org/10.1038/nmeth.1618) Review by Joachim Goedhart at https://thenode.biologists.com/data-visualization-with-flying-colors/research/." - - public let author = "Masataka Okabe, Kei Ito" - public let license = "Awaiting Response" - public let licenseCopy = "Kohei Musha. Ask for permission" - public let link = URL(string: "https://jfly.uni-koeln.de/color/")! - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case black - case orange - case blueSky - case bluishGreen - case blue - case yellow - case vermillion - case reddishPurple - - public var srgba: ICSRGBA { - switch self { - case .black: return ICSRGBA(0) - case .orange: return ICSRGBA(230, 159, 0) - case .blueSky: return ICSRGBA(86, 180, 233) - case .bluishGreen: return ICSRGBA(0, 158, 115) - case .blue: return ICSRGBA(0, 114, 178) - case .yellow: return ICSRGBA(240, 228, 66) - case .vermillion: return ICSRGBA(213, 94, 0) - case .reddishPurple: return ICSRGBA(204, 121, 167) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+DivergingData.swift b/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+DivergingData.swift deleted file mode 100644 index 10ca63e..0000000 --- a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+DivergingData.swift +++ /dev/null @@ -1,152 +0,0 @@ -import Foundation - -public extension ICPalettes.PaulTol.DivergingData { - - struct Sunset: AccessiblePalette { - - public let title = "Sunset" - - public let description = """ -Colors can be used as given or linearly interpolated using equidistant points, but should not be mixed with other schemes. For clarity, the selected colors follow a non-linear progression. -""" - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .divergingData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blueExtreme - case blue1 - case blue2 - case blue3 - case blue4 - case middle - case red4 - case red3 - case red2 - case red1 - case redExtreme - case badDataWhite - - public var srgba: ICSRGBA { - switch self { - case .blueExtreme: return ICSRGBA(54, 75, 154) - case .blue1: return ICSRGBA(74, 123, 183) - case .blue2: return ICSRGBA(110, 166, 205) - case .blue3: return ICSRGBA(152, 202, 225) - case .blue4: return ICSRGBA(194, 228, 239) - case .middle: return ICSRGBA(234, 236, 204) - case .red4: return ICSRGBA(254, 218, 139) - case .red3: return ICSRGBA(253, 179, 102) - case .red2: return ICSRGBA(246, 126, 75) - case .red1: return ICSRGBA(221, 61, 45) - case .redExtreme: return ICSRGBA(165, 0, 38) - case .badDataWhite: return ICSRGBA(255) - } - } - } - } - - struct BuRd: AccessiblePalette { - - public let title = "BuRd" - - public let description = """ -Colors can be used as given or linearly interpolated using equidistant points, but should not be mixed with other schemes. For clarity, the selected colors follow a non-linear progression. -""" - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .divergingData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blueExtreme - case blue1 - case blue2 - case blue3 - case middle - case red3 - case red2 - case red1 - case redExtreme - case badDataGrey - - public var srgba: ICSRGBA { - switch self { - case .blueExtreme: return ICSRGBA(33, 102, 172) - case .blue1: return ICSRGBA(67, 147, 195) - case .blue2: return ICSRGBA(146, 197, 222) - case .blue3: return ICSRGBA(209, 229, 240) - case .middle: return ICSRGBA(247) - case .red3: return ICSRGBA(253, 219, 199) - case .red2: return ICSRGBA(244, 165, 130) - case .red1: return ICSRGBA(214, 96, 77) - case .redExtreme: return ICSRGBA(178, 24, 43) - case .badDataGrey: return ICSRGBA(255, 238, 153) - } - } - } - } - - struct PRGn: AccessiblePalette { - - public let title = "PRGn" - - public let description = """ -Print-friendly. Colors can be used as given or linearly interpolated using equidistant points, but should not be mixed with other schemes. For clarity, the selected colors follow a non-linear progression. -""" - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .divergingData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case purpleExtreme - case purple1 - case purple2 - case purple3 - case middle - case green3 - case green2 - case green1 - case greenExtreme - case badDataGrey - - public var srgba: ICSRGBA { - switch self { - case .purpleExtreme: return ICSRGBA(118, 42, 131) - case .purple1: return ICSRGBA(153, 112, 171) - case .purple2: return ICSRGBA(194, 165, 207) - case .purple3: return ICSRGBA(231, 212, 232) - case .middle: return ICSRGBA(247) - case .green3: return ICSRGBA(217, 240, 211) - case .green2: return ICSRGBA(172, 211, 158) - case .green1: return ICSRGBA(90, 174, 97) - case .greenExtreme: return ICSRGBA(27, 120, 55) - case .badDataGrey: return ICSRGBA(255, 238, 153) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+QualitativeData.swift b/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+QualitativeData.swift deleted file mode 100644 index f60bc72..0000000 --- a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+QualitativeData.swift +++ /dev/null @@ -1,297 +0,0 @@ -import Foundation - -public extension ICPalettes.PaulTol.QualitativeData { - - struct Bright: AccessiblePalette { - - public let title = "Bright" - - public let description = """ -Recommended default. Bright qualitative color scheme that is color-blind safe. The main scheme for lines and their labels. -""" - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blue - case cyan - case green - case grey - case red - case purple - case yellow - - public var srgba: ICSRGBA { - switch self { - case .blue: return ICSRGBA(69, 119, 170) - case .cyan: return ICSRGBA(102, 204, 34) - case .green: return ICSRGBA(34, 136, 51) - case .grey: return ICSRGBA(187) - case .red: return ICSRGBA(238, 102, 119) - case .purple: return ICSRGBA(170, 51, 119) - case .yellow: return ICSRGBA(204, 187, 68) - } - } - } - } - - struct HighContrast: AccessiblePalette { - - public let title = "High Contrast" - - public let description = """ -Monochrome vision-safe, color-blind safe, optimized for contrast. -""" - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case black - case blue - case red - case white - case yellow - - public var srgba: ICSRGBA { - switch self { - case .black: return ICSRGBA(0) - case .blue: return ICSRGBA(0, 68, 136) - case .red: return ICSRGBA(187, 85, 102) - case .yellow: return ICSRGBA(221, 170, 51) - case .white: return ICSRGBA(255) - } - } - } - } - - struct Vibrant: AccessiblePalette { - - public let title = "Vibrant" - - public let description = """ -Equally color- blind safe as Bright. It has been designed for data visualization framework TensorBoard, built around their signature orange FF7043. That color has been replaced here to make it print-friendly. -""" - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blue - case cyan - case teal - case orange - case red - case magenta - case grey - - public var srgba: ICSRGBA { - switch self { - case .blue: return ICSRGBA(0, 119, 187) - case .cyan: return ICSRGBA(51, 187, 238) - case .teal: return ICSRGBA(0, 153, 136) - case .orange: return ICSRGBA(238, 119, 51) - case .red: return ICSRGBA(204, 51, 17) - case .magenta: return ICSRGBA(238, 51, 119) - case .grey: return ICSRGBA(187) - } - } - } - } - - struct Muted: AccessiblePalette { - - public let title = "Muted" - - public let description = """ -Equally color- blind safe as Vibrant. Has more colors, but lacking a clear red or medium blue. Pale grey is meant for bad data in maps. -""" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case indigo - case cyan - case teal - case green - case olive - case sand - case rose - case wine - case purple - case greyPale - - public var srgba: ICSRGBA { - switch self { - case .indigo: return ICSRGBA(51, 34, 136) - case .cyan: return ICSRGBA(136, 204, 238) - case .teal: return ICSRGBA(68, 170, 153) - case .green: return ICSRGBA(17, 119, 51) - case .olive: return ICSRGBA(153, 153, 51) - case .sand: return ICSRGBA(221, 204, 119) - case .rose: return ICSRGBA(204, 102, 119) - case .wine: return ICSRGBA(136, 34, 85) - case .purple: return ICSRGBA(170, 68, 153) - case .greyPale: return ICSRGBA(221) - } - } - } - } - - struct PaleTextBackground: AccessiblePalette { - - public let title = "Pale Text Backgrounds" - - public let description = """ -Background for black text. Indistinct in either normal or color-blind vision. Meant for marking text such as cells in a table, not lines or maps. -""" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blue - case cyan - case green - case yellow - case red - case grey - - public var srgba: ICSRGBA { - switch self { - case .blue: return ICSRGBA(187, 204, 238) - case .cyan: return ICSRGBA(204, 238, 255) - case .green: return ICSRGBA(204, 221, 170) - case .yellow: return ICSRGBA(238, 238, 187) - case .red: return ICSRGBA(255, 204, 204) - case .grey: return ICSRGBA(221) - } - } - } - } - - struct DarkText: AccessiblePalette { - - public let title = "Dark Text" - - public let description = """ -For text on a white background. Indistinct in either normal or color-blind vision. Meant for marking large blocks of text, not lines or maps. -""" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blue - case cyan - case green - case yellow - case red - case grey - - public var srgba: ICSRGBA { - switch self { - case .blue: return ICSRGBA(34, 34, 85) - case .cyan: return ICSRGBA(34, 85, 85) - case .green: return ICSRGBA(34, 85, 34) - case .yellow: return ICSRGBA(102, 102, 51) - case .red: return ICSRGBA(102, 51, 51) - case .grey: return ICSRGBA(85) - } - } - } - } - - struct Light: AccessiblePalette { - - public let title = "Light" - - public let description = """ -Fill labelled cells with lighter colors than contained in Bright, and with more clearly readable labels for black text than Pale. Reasonably distinct in both normal and color-blind vision. -""" - - public let tags: [ICPaletteUtilityTag] = [.qualitative] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case blue - case cyan - case mint - case pear - case olive - case yellow - case orange - case pink - case grey - - public var srgba: ICSRGBA { - switch self { - case .blue: return ICSRGBA(119, 170, 221) - case .cyan: return ICSRGBA(153, 221, 255) - case .mint: return ICSRGBA(68, 187, 153) - case .pear: return ICSRGBA(187, 204, 51) - case .olive: return ICSRGBA(170, 170, 0) - case .yellow: return ICSRGBA(238, 221, 136) - case .orange: return ICSRGBA(238, 136, 102) - case .pink: return ICSRGBA(255, 170, 187) - case .grey: return ICSRGBA(221) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+SequentialData.swift b/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+SequentialData.swift deleted file mode 100644 index af594fc..0000000 --- a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol+SequentialData.swift +++ /dev/null @@ -1,369 +0,0 @@ -import Foundation - -public extension ICPalettes.PaulTol.SequentialData { - - /// See Figure 20 for a curated selection [for maps from 1 to 23 colors](https://personal.sron.nl/~pault/data/colorschemes.pdf). - /// - struct DiscreteRainbow_UseMakeRainbowFunc: AccessiblePalette { - - public let title = "Discrete Rainbow" - - public let description = """ -Maximum 23 colors for maps, inspired by the temperature map in the de Volkskrant newspaper. Grey for data gaps. Do not interpolate yourself. Paul's pre-interpolated rainbows for maximum contrast are available by the makeRainbowMax23 function in its enum. -""" - - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .sequentialData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public static var recommendedRainbow14: [ICSRGBA] { - SourceColors.makeRainbowMax23(colors: 14) - } - public static var recommendedRainbow23: [ICSRGBA] { - SourceColors.makeRainbowMax23(colors: 23) - } - - public static func makeRainbowMax23(colors: Int) -> [ICSRGBA] { - SourceColors.makeRainbowMax23(colors: colors) - } - - public func makeRainbowMax23(colors: Int) -> [ICSRGBA] { - SourceColors.makeRainbowMax23(colors: colors) - } - - public enum SourceColors: ICSourceColorSet { - case n1OffWhite - case n2 - case n3 - case n4 - case n5 - case n6 - case n7 - case n8 - case n9Purple - case n10Blue - case n11 - case n12 - case n13 - case n14 - case n15Green - case n16 - case n17 - case n18Yellow - case n19 - case n20 - case n21 - case n22 - case n23 - case n24 - case n25Orange - case n26Red - case n27 - case n28 - case n29Brown - case badDataGrey - - /// Rainbow sans .badDataGrey - public static func makeRainbowMax23(colors: Int) -> [ICSRGBA] { - var selection: [SourceColors] - - switch colors { - case 1: selection = [.n10Blue] - case 2: selection = [.n10Blue, .n26Red] - case 3: selection = [.n10Blue, .n18Yellow, .n26Red] - case 4: selection = [.n10Blue, .n15Green, .n18Yellow, .n26Red] - case 5: selection = [.n10Blue, .n14, .n15Green, .n18Yellow, .n26Red] - case 6: selection = [.n10Blue, .n14, .n15Green, .n17, .n18Yellow, .n26Red] - case 7: selection = [.n9Purple, .n10Blue, .n14, .n15Green, .n17, .n18Yellow, .n26Red] - case 8: selection = [.n9Purple, .n10Blue, .n14, .n15Green, .n17, .n18Yellow, .n23, .n26Red] - case 9: selection = [.n9Purple, .n10Blue, .n14, .n15Green, .n17, .n18Yellow, .n23, .n26Red, .n28] - case 10: selection = [.n9Purple, .n10Blue, .n14, .n15Green, .n17, .n18Yellow, .n21, .n24, .n26Red, .n28] - case 11: selection = [.n9Purple, .n10Blue, .n12, .n14, .n15Green, .n17, .n18Yellow, .n21, .n24, .n26Red, .n28] - case 12: selection = [.n3, .n6, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n17, .n18Yellow, .n21, .n24, .n26Red] - case 13: selection = [.n3, .n6, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n21, .n24, .n26Red] - case 14: selection = [.n3, .n6, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red] - case 15: selection = [.n3, .n6, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n28] - case 16: selection = [.n3, .n5, .n7, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n28] - case 17: selection = [.n3, .n5, .n7, .n8, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n28] - case 18: selection = [.n3, .n5, .n7, .n8, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n27, .n28] - case 19: selection = [.n2, .n4, .n5, .n7, .n8, .n9Purple, .n10Blue, .n12, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n27, .n28] - case 20: selection = [.n2, .n4, .n5, .n7, .n8, .n9Purple, .n10Blue, .n11, .n13, .n14, .n15Green, .n16, .n17, .n18Yellow, .n20, .n22, .n24, .n26Red, .n27, .n28] - case 21: selection = [.n2, .n4, .n5, .n7, .n8, .n9Purple, .n10Blue, .n11, .n13, .n14, .n15Green, .n16, .n17, .n18Yellow, .n19, .n21, .n23, .n25Orange, .n26Red, .n27, .n28] - - case 22: selection = [.n2, .n4, .n5, .n7, .n8, .n9Purple, .n10Blue, .n11, .n13, .n14, .n15Green, .n16, .n17, .n18Yellow, .n19, .n21, .n23, .n25Orange, .n26Red, .n27, .n28, .n28] - case 23: selection = [.n1OffWhite, .n2, .n4, .n5, .n7, .n8, .n9Purple, .n10Blue, .n11, .n13, .n14, .n15Green, .n16, .n17, .n18Yellow, .n19, .n21, .n23, .n25Orange, .n26Red, .n27, .n28, .n28] - - default: selection = [] - } - - return selection.map { $0.srgba } - } - - public var srgba: ICSRGBA { - switch self { - case .n1OffWhite: return ICSRGBA(232,236,251) - case .n2: return ICSRGBA(217, 204, 227) - case .n3: return ICSRGBA(209, 187, 215) - case .n4: return ICSRGBA(202, 172, 203) - case .n5: return ICSRGBA(186, 141, 180) - case .n6: return ICSRGBA(174, 118, 163) - case .n7: return ICSRGBA(170, 111, 158) - case .n8: return ICSRGBA(153, 79, 136) - case .n9Purple: return ICSRGBA(136, 46, 114) - case .n10Blue: return ICSRGBA(25, 101, 176) - case .n11: return ICSRGBA(67, 125, 191) - case .n12: return ICSRGBA(82, 137, 199) - case .n13: return ICSRGBA(97, 149, 207) - case .n14: return ICSRGBA(123, 175, 222) - case .n15Green: return ICSRGBA(78, 178, 101) - case .n16: return ICSRGBA(144, 201, 135) - case .n17: return ICSRGBA(202, 224, 171) - case .n18Yellow: return ICSRGBA(247, 240, 86) - case .n19: return ICSRGBA(247, 203, 69) - case .n20: return ICSRGBA(246, 193, 65) - case .n21: return ICSRGBA(244, 167, 54) - case .n22: return ICSRGBA(241, 147, 45) - case .n23: return ICSRGBA(238, 128, 38) - case .n24: return ICSRGBA(232, 96, 28) - case .n25Orange: return ICSRGBA(230, 85, 24) - case .n26Red: return ICSRGBA(220, 5, 12) - case .n27: return ICSRGBA(165, 23, 14) - case .n28: return ICSRGBA(114, 25, 14) - case .n29Brown: return ICSRGBA(66,21,10) - case .badDataGrey: return ICSRGBA(119) - } - } - } - } - - struct SmoothLinearInterpolationRainbow: AccessiblePalette { - - public let title = "Smooth Rainbow" - - public let description = """ -Grey for data gaps. If lowest data value occurs often, start at off-white. Otherwise, start at purple and use off-white for bad data. If the highest value occurs often, end at red instead of brown. Light purples and light blues should not be mixed much for color blind people. Can be linearly interpolated, but is best to use a subset of colors. -""" - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .sequentialData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case offWhiteBadDataOrFrequentyLowExtreme - case nMin1 - case nMin2 - case nMin3 - case nMin4 - case nMin5 - case nMin6 - case nMin7 - case nMin8PurpleStart - case nMid0 - case nMid1 - case nMid2 - case nMid3 - case nMid4 - case nMid5 - case nMid6 - case nMid7 - case nMid8 - case nMid9 - case nMid10 - case nMid11 - case nMid12 - case nMid13 - case nMid14 - case nMid15 - case nMid16 - case nMid17 - case nMid18 - case nMid19 - case nMax0Red - case nMax1 - case nMax2 - case nMax3 - case nMax4Brown - case badDataGrey - - public var srgba: ICSRGBA { - switch self { - case .offWhiteBadDataOrFrequentyLowExtreme: return ICSRGBA(232, 236, 251) - case .nMin1: return ICSRGBA(221, 216, 239) - case .nMin2: return ICSRGBA(209, 193, 225) - case .nMin3: return ICSRGBA(195, 168, 209) - case .nMin4: return ICSRGBA(181, 143, 194) - case .nMin5: return ICSRGBA(167, 120, 180) - case .nMin6: return ICSRGBA(155, 98, 167) - case .nMin7: return ICSRGBA(140, 78, 153) - case .nMin8PurpleStart: return ICSRGBA(111, 76, 155) - case .nMid0: return ICSRGBA(96, 89, 169) - case .nMid1: return ICSRGBA(85, 104, 184) - case .nMid2: return ICSRGBA(78, 121, 197) - case .nMid3: return ICSRGBA(77, 138, 198) - case .nMid4: return ICSRGBA(78, 150, 188) - case .nMid5: return ICSRGBA(84, 158, 179) - case .nMid6: return ICSRGBA(89, 165, 169) - case .nMid7: return ICSRGBA(96, 171, 158) - case .nMid8: return ICSRGBA(105, 177, 144) - case .nMid9: return ICSRGBA(119, 183, 125) - case .nMid10: return ICSRGBA(140, 188, 104) - case .nMid11: return ICSRGBA(166, 190, 84) - case .nMid12: return ICSRGBA(190, 188, 72) - case .nMid13: return ICSRGBA(209, 181, 65) - case .nMid14: return ICSRGBA(221, 170, 60) - case .nMid15: return ICSRGBA(228, 156, 57) - case .nMid16: return ICSRGBA(231, 140, 53) - case .nMid17: return ICSRGBA(230, 121, 50) - case .nMid18: return ICSRGBA(228, 99, 45) - case .nMid19: return ICSRGBA(223, 72, 40) - case .nMax0Red: return ICSRGBA(218, 34, 34) - case .nMax1: return ICSRGBA(184, 34, 30) - case .nMax2: return ICSRGBA(149, 33, 27) - case .nMax3: return ICSRGBA(114, 30, 23) - case .nMax4Brown: return ICSRGBA(82, 26, 19) - case .badDataGrey: return ICSRGBA(102) - } - } - } - } - - struct Iridescent: AccessiblePalette { - - public let title = "Iridescent" - - public let description = """ -Grey for data gaps. Good for monochrome vision. Colors can be linearly interpolated or pushed to white or black. -""" - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .sequentialData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Min - case color1 - case color2 - case color3 - case color4 - case color5 - case color6 - case color7 - case color8 - case color9 - case color10 - case color11 - case color12 - case color13 - case color14 - case color15 - case color16 - case color17 - case color18 - case color19 - case color20 - case color21 - case color22Max - case badDataGrey - - public var srgba: ICSRGBA { - switch self { - case .color0Min: return ICSRGBA(254, 251, 233) - case .color1: return ICSRGBA(252, 247, 213) - case .color2: return ICSRGBA(245, 243, 193) - case .color3: return ICSRGBA(234, 240, 181) - case .color4: return ICSRGBA(221, 236, 191) - case .color5: return ICSRGBA(208, 231, 202) - case .color6: return ICSRGBA(194, 227, 210) - case .color7: return ICSRGBA(181, 221, 216) - case .color8: return ICSRGBA(168, 216, 220) - case .color9: return ICSRGBA(155, 210, 225) - case .color10: return ICSRGBA(141, 203, 228) - case .color11: return ICSRGBA(129, 196, 231) - case .color12: return ICSRGBA(123, 188, 231) - case .color13: return ICSRGBA(126, 178, 228) - case .color14: return ICSRGBA(136, 165, 221) - case .color15: return ICSRGBA(147, 152, 210) - case .color16: return ICSRGBA(155, 138, 196) - case .color17: return ICSRGBA(157, 125, 178) - case .color18: return ICSRGBA(154, 112, 158) - case .color19: return ICSRGBA(144, 99, 136) - case .color20: return ICSRGBA(128, 87, 112) - case .color21: return ICSRGBA(104, 73, 87) - case .color22Max: return ICSRGBA(70, 53, 58) - case .badDataGrey: return ICSRGBA(153) - } - } - } - } - - struct YellowOrBrown: AccessiblePalette { - - public let title = "Yellow Or Brown" - - public let description = """ -Grey for data gaps. Print-friendly. color0Min can be set to white for density histograms. -""" - - public let tags: [ICPaletteUtilityTag] = [.quantitative, - .sequentialData] - - public let author = ICPalettes.PaulTol.author - public let license = ICPalettes.PaulTol.license - public let licenseCopy = ICPalettes.PaulTol.licenseCopy - public let link = ICPalettes.PaulTol.link - - public var id: String { title + author } - public var srgba: [ICSRGBA] { SourceColors.allCases.map { $0.srgba} } - public init() {} - - public enum SourceColors: ICSourceColorSet { - case color0Min - case color1 - case color2 - case color3 - case color4 - case color5 - case color6 - case color7 - case color8Max - case badDataGrey - - public var srgba: ICSRGBA { - switch self { - case .color0Min: return ICSRGBA(255, 255, 229) - case .color1: return ICSRGBA(255, 247, 188) - case .color2: return ICSRGBA(254, 227, 145) - case .color3: return ICSRGBA(254, 196, 79) - case .color4: return ICSRGBA(251, 154, 41) - case .color5: return ICSRGBA(236, 112, 20) - case .color6: return ICSRGBA(204, 76, 2) - case .color7: return ICSRGBA(153, 52, 4) - case .color8Max: return ICSRGBA(102, 37, 6) - case .badDataGrey: return ICSRGBA(136) - } - } - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol.swift b/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol.swift deleted file mode 100644 index f5bb5f5..0000000 --- a/Sources/InclusiveColorTools/Palettes/PaulTol/PaulTol.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation - -public extension ICPalettes { - - /// For presenting data in maps and graphs. [Personal blog](https://personal.sron.nl/~pault/) with analysis of color schemes for scientific data presentation. - /// - struct PaulTol { - - public struct DivergingData { } - public struct QualitativeData { } - public struct SequentialData { } - - internal static var author: String = { "Paul Tol" }() - internal static let link: URL = { URL(string: "https://personal.sron.nl/~pault/data/colorschemes.pdf")! }() - internal static var license: String = { "Standard 3-clause BSD" }() - internal static var licenseCopy: String = { """ -Copyright (c) 2019 Paul Tol, All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -""" - }() - - } -} diff --git a/Sources/InclusiveColorTools/Palettes/_Models/AccessiblePalette.swift b/Sources/InclusiveColorTools/Palettes/_Models/AccessiblePalette.swift deleted file mode 100644 index d64262d..0000000 --- a/Sources/InclusiveColorTools/Palettes/_Models/AccessiblePalette.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation - -public protocol AccessiblePalette { - - /// Palette title - var title: String { get } - - var description: String { get } - - var tags: [ICPaletteUtilityTag] { get } - - var author: String { get } - - /// Short name for the license - var license: String { get } - - /// License full text - var licenseCopy: String { get } - - var link: URL { get } - - var colorCount: Int { get } - - var srgba: [ICSRGBA] { get } - - /// Title + author - var id: String { get } -} - -extension AccessiblePalette { - public var colorCount: Int { - srgba.count - } -} diff --git a/Sources/InclusiveColorTools/Palettes/_Models/ICPaletteUtilityTag.swift b/Sources/InclusiveColorTools/Palettes/_Models/ICPaletteUtilityTag.swift deleted file mode 100644 index 767dc19..0000000 --- a/Sources/InclusiveColorTools/Palettes/_Models/ICPaletteUtilityTag.swift +++ /dev/null @@ -1,32 +0,0 @@ -import Foundation - -public enum ICPaletteUtilityTag { - case qualitative - case quantitative - case divergingData - case sequentialData - case multisequentialData - case cyclicalData - - public var name: String { - switch self { - case .sequentialData: return "Sequential Data" - case .divergingData: return "Diverging Data" - case .qualitative: return "Qualitative" - case .quantitative: return "Quantitative" - case .multisequentialData: return "Multisequential" - case .cyclicalData: return "Cyclical" - } - } - - public var explanation: String { - switch self { - case .sequentialData: return "Ordered low to high" - case .divergingData: return "Deviation from the midpoint is important. For clarity, use only one scheme per screen." - case .qualitative: return "Nominal or categorical data, where magnitude differences are irrelevant. This includes lines in plots and text in presentations." - case .quantitative: return "" - case .multisequentialData: return "Present distinct sequential series in one plot." - case .cyclicalData: return "Periodic data with an orientation" - } - } -} diff --git a/Sources/InclusiveColorTools/Palettes/_Models/ICSourceColorSet.swift b/Sources/InclusiveColorTools/Palettes/_Models/ICSourceColorSet.swift deleted file mode 100644 index e361c90..0000000 --- a/Sources/InclusiveColorTools/Palettes/_Models/ICSourceColorSet.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -public protocol ICSourceColorSet: CaseIterable { - var srgba: ICSRGBA { get } -} - -public extension ICSourceColorSet { - static var srgba: [ICSRGBA] { Self.allCases.map { $0.srgba } } -} diff --git a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+AppKit.swift b/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+AppKit.swift deleted file mode 100644 index 73a8d1d..0000000 --- a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+AppKit.swift +++ /dev/null @@ -1,32 +0,0 @@ -#if canImport(AppKit) && !targetEnvironment(macCatalyst) -import AppKit - -public extension ICSourceColorSet { - var nscolor: NSColor { - NSColor(srgba) - } - - static var nscolors: [NSColor] { - Self.allCases.map { NSColor($0.srgba) } - } -} - -public extension AccessiblePalette { - var nscolors: [NSColor] { - srgba.nscolors - } -} - -public extension ICPalettes.AllPalettes { - var nscolors: [NSColor] { - colors_SRGBA.nscolors - } -} - -public extension NSColor { - - /// These published color blindness-friendly palettes are free, with licenses for inclusion in your app. A visual browser is available on the Mac App Store as "Inclusive Color". - /// - static let InclusiveColors = ICPalettes.self -} -#endif diff --git a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+SwiftUI.swift b/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+SwiftUI.swift deleted file mode 100644 index 7948af5..0000000 --- a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+SwiftUI.swift +++ /dev/null @@ -1,36 +0,0 @@ -#if canImport(SwiftUI) -import SwiftUI - -public extension ICSourceColorSet { - @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, *) - var swiftUI: Color { - Color(srgba) - } - - @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, *) - static var swiftUI: [Color] { Self.allCases.map { Color($0.srgba) } } -} - -public extension AccessiblePalette { - @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, *) - var swiftUIcolors: [Color] { - srgba.swiftUIcolors - } -} - -public extension ICPalettes.AllPalettes { - @available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, *) - var swiftUIcolors: [Color] { - colors_SRGBA.swiftUIcolors - } -} - -@available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, *) -public extension Color { - - /// These published color blindness-friendly palettes are free, with licenses for inclusion in your app. A visual browser is available on the Mac App Store as "Inclusive Color". - /// - static let InclusiveColors = ICPalettes.self -} - -#endif diff --git a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+UIKit.swift b/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+UIKit.swift deleted file mode 100644 index 1d9747c..0000000 --- a/Sources/InclusiveColorTools/Palettes/_UI+/ICPalettes+UIKit.swift +++ /dev/null @@ -1,32 +0,0 @@ -#if canImport(UIKit) -import UIKit - -public extension ICSourceColorSet { - var uicolor: UIColor { - UIColor(srgba) - } - - static var uicolors: [UIColor] { - Self.allCases.map { UIColor($0.srgba) } - } -} - -public extension AccessiblePalette { - var uicolors: [UIColor] { - srgba.uiColors - } -} - -public extension ICPalettes.AllPalettes { - var uicolors: [UIColor] { - colors_SRGBA.uiColors - } -} - -public extension UIColor { - - /// These published color blindness-friendly palettes are free, with licenses for inclusion in your app. A visual browser is available on the Mac App Store as "Inclusive Color". - /// - static let InclusiveColors = ICPalettes.self -} -#endif diff --git a/Tests/InclusiveColorTests/InclusiveColorTests.swift b/Tests/InclusiveColorTests/InclusiveColorTests.swift index ab47130..7b87257 100644 --- a/Tests/InclusiveColorTests/InclusiveColorTests.swift +++ b/Tests/InclusiveColorTests/InclusiveColorTests.swift @@ -10,7 +10,6 @@ final class InclusiveColorTests: XCTestCase { func testAPIStability_InclusiveColorAutocompletion() { - XCTAssertTrue(InclusiveColor.tools.palettes == ICPalettes.self) XCTAssertNotNil(InclusiveColor.tools.simulator) // MARK: - These must compile!! diff --git a/Tests/InclusiveColorTests/InclusiveColorToolsTests.swift b/Tests/InclusiveColorTests/InclusiveColorToolsTests.swift index 9599988..0be9b10 100644 --- a/Tests/InclusiveColorTests/InclusiveColorToolsTests.swift +++ b/Tests/InclusiveColorTests/InclusiveColorToolsTests.swift @@ -10,7 +10,6 @@ final class InclusiveColorToolsTests: XCTestCase { func testAPIStability_InclusiveColorToolsAutocompletion() { - XCTAssertTrue(InclusiveColorTools.palettes == ICPalettes.self) XCTAssertNotNil(InclusiveColorTools.simulator) // MARK: - These must compile!! diff --git a/Tests/InclusiveColorTests/Tools/Assess/Metrics/CustomDeltaE/JzazbzColorSpaceTests.swift b/Tests/InclusiveColorTests/Tools/Assess/Metrics/CustomDeltaE/JzazbzColorSpaceTests.swift index d00858c..5fd27f2 100644 --- a/Tests/InclusiveColorTests/Tools/Assess/Metrics/CustomDeltaE/JzazbzColorSpaceTests.swift +++ b/Tests/InclusiveColorTests/Tools/Assess/Metrics/CustomDeltaE/JzazbzColorSpaceTests.swift @@ -28,6 +28,22 @@ class ICJzazbzColorSpaceTests: XCTestCase { XCTAssertEqual(result4, 0) } + func testConversionIsLossless() { + + let sut = ICJzazbzColorSpace.self + let test1 = sRGBColor.one + let test2 = sRGBColor(0.2, 0.3, 0.4) + + let result1_ = sut._transformSRGBtoJzazbz(test1) + let result1 = sut.transformJzazbzToSRGB(result1_) + + let result2_ = sut._transformSRGBtoJzazbz(test2) + let result2 = sut.transformJzazbzToSRGB(result2_) + + AssertColorsComparable(exp: test1, sut: result1, rgb888Tolerance: 0) + AssertColorsComparable(exp: test2, sut: result2, rgb888Tolerance: 0) + } + func testArbitrary0359Threshold_TracksDeltaE_ContrastsWithWCAG2RelativeLuminance() throws { let sut = ICJzazbzColorSpace.getScaledDeltaE let sut2 = ICMeaningfulColorsMetrics._experimental(._scaledJzazbzDeltaE_StronglyDifferentiableComparableToCIE2000).threshold diff --git a/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+AppKit.swift b/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+AppKit.swift deleted file mode 100644 index 663755b..0000000 --- a/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+AppKit.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation -import XCTest -@testable import InclusiveColor -#if canImport(AppKit) && !targetEnvironment(macCatalyst) -import AppKit - - -class PalettesAppKitTests: XCTestCase { - - static var allTests = [ - ("test_SourceColorSet_HasNSColors", test_SourceColorSet_HasNSColors), - ("test_AccessiblePalette_HasNSColors", test_AccessiblePalette_HasNSColors), - ("test_AllPalettes_HasNSColors", test_AllPalettes_HasNSColors), - ("test_AllPalettes_AvailableByColorExtension", test_AllPalettes_AvailableByColorExtension) - ] - - func test_SourceColorSet_HasNSColors() throws { - - let sut = ICPalettes.AllieOfisher.SixPalette1.SourceColors.nscolors - - XCTAssertEqual(sut, ICPalettes.AllieOfisher.SixPalette1().nscolors) - XCTAssertGreaterThan(sut.count, 1) - - } - - func test_AccessiblePalette_HasNSColors() throws { - - let sut = ICPalettes.AllieOfisher.SixPalette1() - XCTAssertEqual(sut.nscolors.count, 6) - } - - func test_AllPalettes_HasNSColors() throws { - - let sut = ICPalettes.AllPalettes.allCases[0].nscolors - XCTAssertGreaterThan(sut.count, 1) - } - - func test_AllPalettes_AvailableByColorExtension() throws { - - let sut = InclusiveColor.tools.palettes - XCTAssertTrue(sut == ICPalettes.self) - - } - -} -#endif diff --git a/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+SwiftUI.swift b/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+SwiftUI.swift deleted file mode 100644 index d66135e..0000000 --- a/Tests/InclusiveColorTests/Tools/Palettes/PalettesTests+SwiftUI.swift +++ /dev/null @@ -1,44 +0,0 @@ -import Foundation -import XCTest -@testable import InclusiveColor -import SwiftUI - -@available(iOS 13.0, OSX 10.15, watchOS 6.0, tvOS 13, macCatalyst 14, *) -class PalettesSwiftUITests: XCTestCase { - - static var allTests = [ - ("test_SourceColorSet_HasSwiftUIColors", test_SourceColorSet_HasSwiftUIColors), - ("test_AccessiblePalette_HasSwiftUIColors", test_AccessiblePalette_HasSwiftUIColors), - ("test_AllPalettes_HasSwiftUIColors", test_AllPalettes_HasSwiftUIColors), - ("test_AllPalettes_AvailableByColorExtension", test_AllPalettes_AvailableByColorExtension) - ] - - func test_SourceColorSet_HasSwiftUIColors() throws { - - let sut = ICPalettes.AllieOfisher.SixPalette1.SourceColors.swiftUI - - XCTAssertEqual(sut, ICPalettes.AllieOfisher.SixPalette1().swiftUIcolors) - XCTAssertGreaterThan(sut.count, 1) - - } - - func test_AccessiblePalette_HasSwiftUIColors() throws { - - let sut = ICPalettes.AllieOfisher.SixPalette1() - XCTAssertEqual(sut.swiftUIcolors.count, 6) - } - - func test_AllPalettes_HasSwiftUIColors() throws { - - let sut = ICPalettes.AllPalettes.allCases[0].swiftUIcolors - XCTAssertGreaterThan(sut.count, 1) - } - - func test_AllPalettes_AvailableByColorExtension() throws { - - let sut = InclusiveColor.tools.palettes - XCTAssertTrue(sut == ICPalettes.self) - - } - -} diff --git a/Tests/InclusiveColorTests/XCTestManifests.swift b/Tests/InclusiveColorTests/XCTestManifests.swift index 1bae45f..eba28d5 100644 --- a/Tests/InclusiveColorTests/XCTestManifests.swift +++ b/Tests/InclusiveColorTests/XCTestManifests.swift @@ -34,8 +34,6 @@ public func allTests() -> [XCTestCaseEntry] { testCase(MeaningfulColorsMetricsTests.allTests), testCase(MeaningfulColorsStatisticsTests.allTests), testCase(NativeColorsDescriptionTests.allTests), - testCase(PalettesAppKitTests.allTests), - testCase(PalettesSwiftUITests.allTests), testCase(sRGBColorDebugStringsTests.allTests), testCase(ICSRGBACustomStringConvertibleTests.allTests), testCase(ICSRGBAInitByChannelTests.allTests),