-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.Case06.Colors.swift
54 lines (47 loc) · 2.09 KB
/
Test.Case06.Colors.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen
#if os(OSX)
import AppKit.NSColor
typealias Color = NSColor
#elseif os(iOS) || os(tvOS) || os(watchOS)
import UIKit.UIColor
typealias Color = UIColor
#endif
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable operator_usage_whitespace
extension Color {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0
let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0
let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0
self.init(red: red, green: green, blue: blue, alpha: alpha)
}
}
// swiftlint:enable operator_usage_whitespace
// swiftlint:disable identifier_name line_length type_body_length
struct ColorName {
let rgbaValue: UInt32
var color: Color { return Color(named: self) }
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#339666"></span>
/// Alpha: 100% <br/> (0x339666ff)
static let articleBody = ColorName(rgbaValue: 0x339666ff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
static let articleFootnote = ColorName(rgbaValue: 0xff66ccff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#33fe66"></span>
/// Alpha: 100% <br/> (0x33fe66ff)
static let articleTitle = ColorName(rgbaValue: 0x33fe66ff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ff66cc"></span>
/// Alpha: 100% <br/> (0xff66ccff)
static let cyanColor = ColorName(rgbaValue: 0xff66ccff)
/// <span style="display:block;width:3em;height:2em;border:1px solid black;background:#ffffff"></span>
/// Alpha: 80% <br/> (0xffffffcc)
static let translucent = ColorName(rgbaValue: 0xffffffcc)
}
// swiftlint:enable identifier_name line_length type_body_length
extension Color {
convenience init(named color: ColorName) {
self.init(rgbaValue: color.rgbaValue)
}
}