df73f6d066
They don’t really make sense, since there’s no way to use them on Linux, without linking to some form of Linux rendering framework.
59 lines
1.1 KiB
Swift
59 lines
1.1 KiB
Swift
/**
|
|
* Splash
|
|
* Copyright (c) John Sundell 2018
|
|
* MIT license - see LICENSE.md
|
|
*/
|
|
|
|
import Foundation
|
|
|
|
#if !os(Linux)
|
|
|
|
/// A representation of a color, for use with a `Theme`.
|
|
/// Since Splash aims to be cross-platform, it uses this
|
|
/// simplified color representation rather than `NSColor`
|
|
/// or `UIColor`.
|
|
public struct Color {
|
|
public var red: Double
|
|
public var green: Double
|
|
public var blue: Double
|
|
public var alpha: Double
|
|
|
|
public init(red: Double, green: Double, blue: Double, alpha: Double = 1) {
|
|
self.red = red
|
|
self.green = green
|
|
self.blue = blue
|
|
self.alpha = alpha
|
|
}
|
|
}
|
|
|
|
internal extension Color {
|
|
var renderable: Renderable {
|
|
return Renderable(
|
|
red: CGFloat(red),
|
|
green: CGFloat(green),
|
|
blue: CGFloat(blue),
|
|
alpha: CGFloat(alpha)
|
|
)
|
|
}
|
|
}
|
|
|
|
#endif
|
|
|
|
#if os(iOS)
|
|
|
|
import UIKit
|
|
|
|
internal extension Color {
|
|
typealias Renderable = UIColor
|
|
}
|
|
|
|
#elseif os(macOS)
|
|
|
|
import Cocoa
|
|
|
|
internal extension Color {
|
|
typealias Renderable = NSColor
|
|
}
|
|
|
|
#endif
|