Mercurial > public > stock-charts
changeset 106:0c0d38dca6d8
Change colours to native swiftUI
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 28 Jun 2021 13:48:03 +0200 |
parents | facd63329f23 |
children | b0c81b2e624d |
files | README.md Sources/StockCharts/CapsuleChart/CapsuleChartView.swift Sources/StockCharts/LineChart/Helpers/ChartLabel.swift Sources/StockCharts/LineChart/Helpers/IndicatorPoint.swift Sources/StockCharts/LineChart/Helpers/LineView.swift StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate |
diffstat | 6 files changed, 9 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sun Jun 27 16:37:21 2021 +0200 +++ b/README.md Mon Jun 28 13:48:03 2021 +0200 @@ -46,7 +46,7 @@ RoundedRectangle(cornerRadius: 25) .frame(width: 400, height: 120) .foregroundColor(.white) - .shadow(color: Color(.gray).opacity(0.15), radius: 10) + .shadow(color: Color(,.gray).opacity(0.15), radius: 10) .overlay( VStack(alignment: .leading) { Text("Dennis Concepcion")
--- a/Sources/StockCharts/CapsuleChart/CapsuleChartView.swift Sun Jun 27 16:37:21 2021 +0200 +++ b/Sources/StockCharts/CapsuleChart/CapsuleChartView.swift Mon Jun 28 13:48:03 2021 +0200 @@ -17,24 +17,13 @@ ZStack { GeometryReader { proxy in Group { - #if os(iOS) Capsule() - .foregroundColor(Color(.systemGray)) + .foregroundColor(Color.gray) .opacity(0.2) Capsule() - .foregroundColor(Color(.systemBlue)) + .foregroundColor(Color.blue) .frame(width: proxy.size.width * percentageOfWidth) - #elseif os(watchOS) - Capsule() - .foregroundColor(Color(.gray)) - .opacity(0.2) - - Capsule() - .foregroundColor(Color(.blue)) - .frame(width: proxy.size.width * percentageOfWidth) - #endif - } .frame(height: 10) }
--- a/Sources/StockCharts/LineChart/Helpers/ChartLabel.swift Sun Jun 27 16:37:21 2021 +0200 +++ b/Sources/StockCharts/LineChart/Helpers/ChartLabel.swift Mon Jun 28 13:48:03 2021 +0200 @@ -28,14 +28,8 @@ .opacity(0.5) } - #if os(iOS) Text("\(data[indexPosition], specifier: "%.2f")") - .foregroundColor(Color(.systemBlue)) - - #elseif os(watchOS) - Text("\(data[indexPosition], specifier: "%.2f")") - .foregroundColor(Color(.blue)) - #endif + .foregroundColor(Color.blue) } .font(.caption)
--- a/Sources/StockCharts/LineChart/Helpers/IndicatorPoint.swift Sun Jun 27 16:37:21 2021 +0200 +++ b/Sources/StockCharts/LineChart/Helpers/IndicatorPoint.swift Mon Jun 28 13:48:03 2021 +0200 @@ -9,16 +9,8 @@ public struct IndicatorPoint: View { public var body: some View { - #if os(iOS) Circle() .frame(width: 20, height: 20) - .foregroundColor(Color(.systemBlue)) - - #elseif os(watchOS) - Circle() - .frame(width: 20, height: 20) - .foregroundColor(Color(.blue)) - #endif - + .foregroundColor(Color.blue) } }
--- a/Sources/StockCharts/LineChart/Helpers/LineView.swift Sun Jun 27 16:37:21 2021 +0200 +++ b/Sources/StockCharts/LineChart/Helpers/LineView.swift Mon Jun 28 13:48:03 2021 +0200 @@ -58,26 +58,14 @@ Color path depending on data. */ public func colorLine() -> Color { - #if os(iOS) - let blue = Color(.systemBlue) - let teal = Color(.systemTeal) - let red = Color(.systemRed) - - var color = Color(.systemGreen) - #elseif os(watchOS) - let blue = Color(.blue) - let teal = Color(.blue) - let red = Color(.red) - - var color = Color(.green) - #endif + var color = Color.green if showingIndicators { - color = blue + color = Color.blue } else if data.first! > data.last! { - color = red + color = Color.red } else if data.first! == data.last! { - color = teal + color = Color.blue } return color