Open zrzka opened 6 years ago
Glad we have all these simulators ...
UIColor *color = [UIColor colorWithRed:1.000000 green:-0.021739 blue:-0.021739 alpha:1.000000];
CGFloat red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
NSLog(@"R %f G %f B %f A %f", red, green, blue, alpha);
NSLog(@"%@", color);
iOS 9.3
R 1.000000 G 0.000000 B 0.000000 A 1.000000
UIDeviceRGBColorSpace 1 0 0 1
iOS 11.2
R 1.000000 G -0.021739 B -0.021739 A 1.000000
UIExtendedSRGBColorSpace 1 -0.021739 -0.021739 1
It seems that iOS 9.3 clamps color components values. And maybe it's not related at all.
Despite the fact that the different iOS versions handles this color differently, when I try to tint button with this particular color in simulator / device, it works. So the problem is elsewhere.
7points user forum follow up
I think I have found the reason for the bug: the color picker of the ui-Designer. When sliding over the colors, the hex value sometimes jumps from 6 digits to eight digits. Since 8-digit values are wrong for ipad pro edition 2015, they will be ignored.
System Information
Working device
User has no issue on iOS 9.3.5, iPad Mini, Pythonista 3.2.
Issues
RGBA
values (negative)Related issues
Probably relates to https://github.com/omz/Pythonista-Issues/issues/374 where you did mention that color parsing is kind of incosistent in the Pythonista.
Also maybe there's difference in how
UIColor
handles negative values when you do callcolorWithRed:green:blue:alpha
between iOS 9 and iOS11? Guessing.Description
See this thread. 7points user somehow managed to create
tint_color
in.pyui
file with following values:RGBA(1.000000,-0.021739,-0.021739,1.000000)
Green is negative, blue is negative.
Inspector in the UI designer shows this color as
fffffffb
I would expect
ff0000ff
.Alert view shows this color as
fffffffa
I would expect
ff0000ff
, or at leastff0000
(see 3).Alert view doesn't accept color with alpha channel
Only six 0-9a-f's can be used. Seventh and eight (alpha channel) are ignored.
I would expect that alpha channel is accepted as well.
Designer shows correct color
Looks like that designer really parses it as
ff0000ff
.Running script
But when you run it, it shows default color.
Sample files
tint.py
:tint.pyui
: