customize text color
This commit is contained in:
@@ -12,11 +12,13 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
//Bar chart accepts data as array of BarChartDataEntry objects
|
||||
var entries : [BarChartDataEntry]
|
||||
var moodTints: [Color]
|
||||
var textColor: Color
|
||||
|
||||
var tmpHolderToMakeViewDiffefrent: Color
|
||||
|
||||
init(fakeData: Bool, backDays: Int, moodTint: [Color]) {
|
||||
init(fakeData: Bool, backDays: Int, moodTint: [Color], textColor: Color) {
|
||||
self.moodTints = moodTint
|
||||
self.textColor = textColor
|
||||
guard moodTints.count == 5 else {
|
||||
fatalError("mood tint count dont match")
|
||||
}
|
||||
@@ -105,8 +107,8 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
|
||||
// change bars color to green
|
||||
dataSet.colors = moodTints.map({ NSUIColor( $0 ) })
|
||||
dataSet.secondaryTextColor = UIColor.systemGray
|
||||
dataSet.valueColors = [.white]
|
||||
dataSet.secondaryTextColor = UIColor(textColor)
|
||||
dataSet.valueColors = [UIColor(textColor)]
|
||||
dataSet.highlightAlpha = 0.0
|
||||
dataSet.roundedCornerValue = 10
|
||||
|
||||
@@ -128,6 +130,6 @@ struct HeaderStatsView : UIViewRepresentable {
|
||||
|
||||
struct HeaderStatsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HeaderStatsView(fakeData: true, backDays: 30, moodTint: [Color.green, Color.blue, Color.yellow, Color.red, Color.orange]).frame(minHeight: 85, maxHeight: 90)
|
||||
HeaderStatsView(fakeData: true, backDays: 30, moodTint: [Color.green, Color.blue, Color.yellow, Color.red, Color.orange], textColor: .white).frame(minHeight: 85, maxHeight: 90)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user