mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Restored lost custom theme commit changes
This commit is contained in:
@@ -6,7 +6,7 @@ import Display
|
||||
|
||||
public enum PresentationBuiltinThemeReference: Int32 {
|
||||
case dayClassic = 0
|
||||
case nightGrayscale = 1
|
||||
case night = 1
|
||||
case day = 2
|
||||
case nightAccent = 3
|
||||
}
|
||||
@@ -178,54 +178,33 @@ public enum PresentationThemeBaseColor: Int32, CaseIterable {
|
||||
case black
|
||||
case white
|
||||
|
||||
public var colorValue: Int32 {
|
||||
public var color: UIColor {
|
||||
let value: UInt32
|
||||
switch self {
|
||||
case .blue:
|
||||
return 0x007ee5
|
||||
value = 0x007aff
|
||||
case .cyan:
|
||||
return 0x00c2ed
|
||||
value = 0x00c2ed
|
||||
case .green:
|
||||
return 0x29b327
|
||||
value = 0x29b327
|
||||
case .pink:
|
||||
return 0xff5da2
|
||||
value = 0xeb6ca4
|
||||
case .orange:
|
||||
return 0xff7519
|
||||
value = 0xf08200
|
||||
case .purple:
|
||||
return 0x7748ff
|
||||
value = 0x9472ee
|
||||
case .red:
|
||||
return 0xf83b4c
|
||||
value = 0xd33213
|
||||
case .yellow:
|
||||
return 0xeba239
|
||||
value = 0xedb400
|
||||
case .gray:
|
||||
return 0x6d839e
|
||||
value = 0x6d839e
|
||||
case .black:
|
||||
return 0x000000
|
||||
value = 0x000000
|
||||
case .white:
|
||||
return 0xffffff
|
||||
value = 0xffffff
|
||||
}
|
||||
|
||||
// switch self {
|
||||
// case .blue:
|
||||
// return 0x007aff
|
||||
// case .cyan:
|
||||
// return 0x00c2ed
|
||||
// case .green:
|
||||
// return 0x70bb23
|
||||
// case .pink:
|
||||
// return 0xeb6ca4
|
||||
// case .orange:
|
||||
// return 0xf08200
|
||||
// case .purple:
|
||||
// return 0x9472ee
|
||||
// case .red:
|
||||
// return 0xd33213
|
||||
// case .yellow:
|
||||
// return 0xedb400
|
||||
// case .gray:
|
||||
// return 0x6d839e
|
||||
// case .black:
|
||||
// return 0x000000
|
||||
// }
|
||||
return UIColor(rgb: value)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,18 +227,17 @@ public struct PresentationThemeAccentColor: PostboxCoding, Equatable {
|
||||
encoder.encodeDouble(Double(self.value), forKey: "v")
|
||||
}
|
||||
|
||||
public var color: Int32 {
|
||||
public var color: UIColor {
|
||||
var hue: CGFloat = 0.0
|
||||
var saturation: CGFloat = 0.0
|
||||
var value: CGFloat = 0.0
|
||||
|
||||
let color = UIColor(rgb: UInt32(bitPattern: self.baseColor.colorValue))
|
||||
let color = self.baseColor.color
|
||||
let delta = (-0.5 + self.value) * 0.8
|
||||
if color.getHue(&hue, saturation: &saturation, brightness: &value, alpha: nil) {
|
||||
let newColor = UIColor(hue: hue, saturation: saturation, brightness: min(1.0, max(0.0, value + delta)), alpha: 1.0)
|
||||
return Int32(bitPattern: newColor.rgb)
|
||||
return UIColor(hue: hue, saturation: saturation, brightness: min(1.0, max(0.0, value + delta)), alpha: 1.0)
|
||||
} else {
|
||||
return self.baseColor.colorValue
|
||||
return color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user