-
Notifications
You must be signed in to change notification settings - Fork 165
/
ChartColors.swift
61 lines (57 loc) · 1.73 KB
/
ChartColors.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
55
56
57
58
59
60
61
//
// ChartColors.swift
//
// Created by Giampaolo Bellavite on 07/11/14.
// Copyright (c) 2014 Giampaolo Bellavite. All rights reserved.
//
import UIKit
/**
Shorthands for various colors to use in the charts.
*/
public struct ChartColors {
static fileprivate func colorFromHex(_ hex: Int) -> UIColor {
let red = CGFloat((hex & 0xFF0000) >> 16) / 255.0
let green = CGFloat((hex & 0xFF00) >> 8) / 255.0
let blue = CGFloat((hex & 0xFF)) / 255.0
return UIColor(red: red, green: green, blue: blue, alpha: 1)
}
static public func blueColor() -> UIColor {
return colorFromHex(0x4A90E2)
}
static public func orangeColor() -> UIColor {
return colorFromHex(0xF5A623)
}
static public func greenColor() -> UIColor {
return colorFromHex(0x7ED321)
}
static public func darkGreenColor() -> UIColor {
return colorFromHex(0x417505)
}
static public func redColor() -> UIColor {
return colorFromHex(0xFF3200)
}
static public func darkRedColor() -> UIColor {
return colorFromHex(0xD0021B)
}
static public func purpleColor() -> UIColor {
return colorFromHex(0x9013FE)
}
static public func maroonColor() -> UIColor {
return colorFromHex(0x8B572A)
}
static public func pinkColor() -> UIColor {
return colorFromHex(0xBD10E0)
}
static public func greyColor() -> UIColor {
return colorFromHex(0x7f7f7f)
}
static public func cyanColor() -> UIColor {
return colorFromHex(0x50E3C2)
}
static public func goldColor() -> UIColor {
return colorFromHex(0xbcbd22)
}
static public func yellowColor() -> UIColor {
return colorFromHex(0xF8E71C)
}
}