Fix chart colors

This commit is contained in:
Ilya Laktyushin 2020-03-23 18:52:11 +04:00
parent bdada453ad
commit 45cdcfba15
6 changed files with 17 additions and 12 deletions

View File

@ -59,7 +59,8 @@ class LinesChartRenderer: BaseChartRenderer {
if chartsAlpha == 0 { return }
let range = renderRange(bounds: bounds, chartFrame: chartFrame)
context.clip(to: CGRect(origin: CGPoint(x: 0.0, y: chartFrame.minY), size: CGSize(width: chartFrame.width + chartFrame.origin.x * 2.0, height: chartFrame.height)))
let spacing: CGFloat = 1.0
context.clip(to: CGRect(origin: CGPoint(x: 0.0, y: chartFrame.minY - spacing), size: CGSize(width: chartFrame.width + chartFrame.origin.x * 2.0, height: chartFrame.height + spacing * 2.0)))
for (index, toLine) in toLines.enumerated() {
let alpha = linesAlphaAnimators[index].current * chartsAlpha

View File

@ -101,6 +101,10 @@ class VerticalScalesRenderer: BaseChartRenderer {
let labelColorAlpha = labelsColor.alphaValue
func drawLines(_ labels: [LinesChartLabel], alpha: CGFloat) {
var labels = labels
if labels.count > 1 {
labels.removeFirst()
}
var lineSegments: [CGPoint] = []
let x0 = chartFrame.minX
let x1 = chartFrame.maxX

View File

@ -546,8 +546,8 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
)
let chart = PresentationThemeChart(
labelsColor: UIColor(rgb: 0x8e8e93),
helperLinesColor: UIColor(rgb: 0xd8d8d8, alpha: 0.2),
strongLinesColor: UIColor(rgb: 0xd8d8d8, alpha: 0.6),
helperLinesColor: UIColor(rgb: 0xd8d8d8, alpha: 0.35),
strongLinesColor: UIColor(rgb: 0xd8d8d8, alpha: 0.35),
barStrongLinesColor: UIColor(rgb: 0xd8d8d8, alpha: 0.45),
detailsTextColor: UIColor(rgb: 0xffffff),
detailsArrowColor: UIColor(rgb: 0xd8d8d8),

View File

@ -424,8 +424,8 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme
chart = chart.withUpdated(
labelsColor: accentColor?.withMultiplied(hue: 1.033, saturation: 0.211, brightness: 0.882).withAlphaComponent(0.6),
helperLinesColor: accentColor?.withMultiplied(hue: 1.037, saturation: 0.271, brightness: 0.671).withAlphaComponent(0.2),
strongLinesColor: accentColor?.withMultiplied(hue: 1.033, saturation: 0.211, brightness: 0.882).withAlphaComponent(0.6),
helperLinesColor: accentColor?.withMultiplied(hue: 1.037, saturation: 0.271, brightness: 0.671).withAlphaComponent(0.35),
strongLinesColor: accentColor?.withMultiplied(hue: 1.037, saturation: 0.271, brightness: 0.671).withAlphaComponent(0.35),
barStrongLinesColor: accentColor?.withMultiplied(hue: 1.033, saturation: 0.211, brightness: 0.882).withAlphaComponent(0.45),
detailsArrowColor: accentColor?.withMultiplied(hue: 1.051, saturation: 0.254, brightness: 0.376),
detailsViewColor: accentColor?.withMultiplied(hue: 1.035, saturation: 0.571, brightness: 0.184),
@ -804,8 +804,8 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres
let chart = PresentationThemeChart(
labelsColor: UIColor(rgb: 0xbacce1, alpha: 0.6),
helperLinesColor: UIColor(rgb: 0x8596ab, alpha: 0.2),
strongLinesColor: UIColor(rgb: 0xbacce1, alpha: 0.6),
helperLinesColor: UIColor(rgb: 0xbacce1, alpha: 0.35),
strongLinesColor: UIColor(rgb: 0xbacce1, alpha: 0.35),
barStrongLinesColor: UIColor(rgb: 0xbacce1, alpha: 0.45),
detailsTextColor: UIColor(rgb: 0xffffff),
detailsArrowColor: UIColor(rgb: 0x4c5460),

View File

@ -758,8 +758,8 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
let chart = PresentationThemeChart(
labelsColor: UIColor(rgb: 0x252529, alpha: 0.5),
helperLinesColor: UIColor(rgb: 0x182d3b, alpha: 0.1),
strongLinesColor: UIColor(rgb: 0x182d3b, alpha: 0.35),
helperLinesColor: UIColor(rgb: 0x182d3b, alpha: 0.3),
strongLinesColor: UIColor(rgb: 0x182d3b, alpha: 0.3),
barStrongLinesColor: UIColor(rgb: 0x252529, alpha: 0.2),
detailsTextColor: UIColor(rgb: 0x6d6d72),
detailsArrowColor: UIColor(rgb: 0xc5c7cd),

View File

@ -64,7 +64,7 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
self.disposable.set(sticker.start(next: { [weak self] data in
if let strongSelf = self {
strongSelf.trackTo(item: ManagedAnimationItem(source: .resource(strongSelf.context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 0), duration: 0.3))
strongSelf.trackTo(item: ManagedAnimationItem(source: .resource(strongSelf.context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 180), duration: 3.0))
}
}))
case .rolling:
@ -73,7 +73,7 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
case let .value(currentValue):
switch diceState {
case .rolling:
self.trackTo(item: ManagedAnimationItem(source: .local("DiceRolling"), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 0), duration: 0.3, loop: true))
self.trackTo(item: ManagedAnimationItem(source: .local("DiceRolling"), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 180), duration: 3.0, loop: true))
case let .value(value):
break
}
@ -103,7 +103,7 @@ final class ManagedDiceAnimationNode: ManagedAnimationNode, GenericAnimatedStick
self.disposable.set(sticker.start(next: { [weak self] data in
if let strongSelf = self {
strongSelf.trackTo(item: ManagedAnimationItem(source: .resource(strongSelf.context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 0), duration: 0.3))
strongSelf.trackTo(item: ManagedAnimationItem(source: .resource(strongSelf.context.account.postbox.mediaBox, file.resource), frames: ManagedAnimationFrameRange(startFrame: 0, endFrame: 180), duration: 3.0))
}
}))
case .rolling: