libcolorpicker icon indicating copy to clipboard operation
libcolorpicker copied to clipboard

When i make my fallback Colour this it doesn't set the Colour to 0% alpha in my tweak preferences instead it sets it to 100% alpha

Open atebitsy-old opened this issue 5 years ago • 2 comments

when i make my fallback Colour this it doesn't set the Colour to 0% alpha in my tweak preferences instead it sets it to 100% alpha #000000:0.00

atebitsy-old avatar Jul 11 '19 11:07 atebitsy-old

Did you ever find a fix for this? I need to make the alpha 0.44, but I can't figure out how to.

CobreDev avatar Jan 31 '20 19:01 CobreDev

The reason is the alpha of fallback UIColor returned by colorFromHex is fixed at 1 https://github.com/atomikpanda/libcolorpicker/blob/3ff8e63e773fa251a4b4bc2b6cbf560661137209/libcolorpicker.mm#L125-L128 A workaround is to manually set default value like this

NSString *colorString = prefs?(prefs[@"bgColor"]?:@"#0027FF:0.2"):@"#0027FF:0.2"; 
UIColor *bgColor = LCPParseColorString(colorString, nil);

brendonjkding avatar Jul 08 '20 16:07 brendonjkding