StyleColor
public struct StyleColor : Codable, Equatable
Represents a color as defined by the Mapbox Style Spec
-
A value from 0 to 255, as required by the Mapbox Style Spec
Declaration
Swift
public let red: Double -
A value from 0 to 255, as required by the Mapbox Style Spec
Declaration
Swift
public let green: Double -
A value from 0 to 255, as required by the Mapbox Style Spec
Declaration
Swift
public let blue: Double -
A value from 0 to 1, as required by the Mapbox Style Spec
Declaration
Swift
public let alpha: Double -
Creates a
StyleColorfrom individually-provided color components. Returns nil if any of the channel values are out of the supported ranges.Declaration
Swift
public init?(red: Double, green: Double, blue: Double, alpha: Double)Parameters
redA value from 0 to 255, as required by the Mapbox Style Spec
greenA value from 0 to 255, as required by the Mapbox Style Spec
blueA value from 0 to 255, as required by the Mapbox Style Spec
alphaA value from 0 to 1, as required by the Mapbox Style Spec
-
Creates a
StyleColorfrom aUIColorDeclaration
Swift
public init(_ color: UIColor)Parameters
colorA
UIColorin the sRGB color space
-
StyleColorcan be decoded from an rgba expression or from an rgba color stringThrows
Throws if neither an rgba expression nor an rbga color string could be decoded.Declaration
Swift
public init(from decoder: Decoder) throwsParameters
decoderThe decoder from which the
StyleColorwill attempt to decode an rgba expression or rgba color string -
StyleColoris always encoded to an rgba color stringThrows
Throws if the provided encoder does not allow encoding the rgba color string.Declaration
Swift
public func encode(to encoder: Encoder) throwsParameters
encoderThe encoder to which the rgba color string is encoded
StyleColor Structure Reference