diff --git a/submodules/LegacyComponents/Sources/TGPhotoPaintColorPicker.m b/submodules/LegacyComponents/Sources/TGPhotoPaintColorPicker.m index 23cc4584ba..1bceed2d44 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoPaintColorPicker.m +++ b/submodules/LegacyComponents/Sources/TGPhotoPaintColorPicker.m @@ -696,8 +696,8 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, CGFloat oval (id)UIColorRGB(0x80c864).CGColor, //green (id)UIColorRGB(0xfcde65).CGColor, //yellow (id)UIColorRGB(0xfc964d).CGColor, //orange - (id)[UIColor blackColor].CGColor, //black - (id)[UIColor whiteColor].CGColor //white + (id)UIColorRGB(0x000000).CGColor, //black + (id)UIColorRGB(0xffffff).CGColor //white ]; }); return colors; diff --git a/submodules/LegacyComponents/Sources/TGPhotoTextEntityView.m b/submodules/LegacyComponents/Sources/TGPhotoTextEntityView.m index ad71a5b1fe..28446ca58d 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoTextEntityView.m +++ b/submodules/LegacyComponents/Sources/TGPhotoTextEntityView.m @@ -187,7 +187,7 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; _style = style; switch (_style) { case TGPhotoPaintTextEntityStyleRegular: - _textView.layer.shadowColor = [[UIColor blackColor] CGColor]; + _textView.layer.shadowColor = [UIColorRGB(0x000000) CGColor]; _textView.layer.shadowOffset = CGSizeMake(0.0f, 4.0f); _textView.layer.shadowOpacity = 0.4f; _textView.layer.shadowRadius = 4.0f; @@ -218,7 +218,7 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; case TGPhotoPaintTextEntityStyleOutlined: { - _textView.textColor = [UIColor whiteColor]; + _textView.textColor = UIColorRGB(0xffffff); _textView.strokeColor = _swatch.color; _textView.frameColor = nil; } @@ -238,9 +238,9 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; } if (lightness > 0.87) { - _textView.textColor = [UIColor blackColor]; + _textView.textColor = UIColorRGB(0x000000); } else { - _textView.textColor = [UIColor whiteColor]; + _textView.textColor = UIColorRGB(0xffffff); } _textView.strokeColor = nil; _textView.frameColor = _swatch.color; @@ -484,6 +484,7 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; @implementation TGPhotoTextView { UIFont *_font; + UIColor *_forcedTextColor; } - (instancetype)initWithFrame:(CGRect)frame @@ -564,6 +565,11 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; self.layoutManager.textContainers.firstObject.lineFragmentPadding = floor(font.pointSize * 0.3); } +- (void)setTextColor:(UIColor *)textColor { + _forcedTextColor = textColor; + [super setTextColor:textColor]; +} + - (void)insertText:(NSString *)text { [self fixTypingAttributes]; [super insertText:text]; @@ -577,9 +583,14 @@ const CGFloat TGPhotoTextSelectionViewHandleSide = 30.0f; } - (void)fixTypingAttributes { + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; if (_font != nil) { - self.typingAttributes = @{NSFontAttributeName: _font}; + attributes[NSFontAttributeName] = _font; } + if (_forcedTextColor != nil) { + attributes[NSForegroundColorAttributeName] = _forcedTextColor; + } + self.typingAttributes = attributes; } @end