File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ IB_DESIGNABLE @interface TORoundedButton : UIControl
117117// / (Defaults to off with 1.0f).
118118@property (nonatomic , assign ) IBInspectable CGFloat tappedTextAlpha;
119119
120- // / Taking the default button background color apply a brightness offset for the tapped color
120+ // / The color of the button's rounded background shape. Applied to `.solid` and `.glass` styles.
121+ @property (nonatomic , strong , nullable ) UIColor *tintColor;
122+
123+ // / Taking the default button background color apply a brightness offset for the tapped color
121124// / (Default is 0.25f. Set 0.0 for off).
122125@property (nonatomic , assign ) IBInspectable CGFloat tappedTintColorBrightnessOffset;
123126
Original file line number Diff line number Diff line change @@ -734,6 +734,14 @@ - (UIColor *)_brightnessAdjustedColorWithColor:(UIColor *)color amount:(CGFloat)
734734 brightnessAdd = 0 .18f * amount;
735735 }
736736
737+ // Greys and other near-neutral colours carry a meaningless hue plus a faint
738+ // undertone (e.g. systemGray leans slightly blue). Boosting their saturation
739+ // amplifies that undertone into a visible tint, so scale the hue/saturation
740+ // changes by how saturated the source already is — leaving brightness alone.
741+ const CGFloat colorfulness = fminf (s / 0 .15f , 1 .0f );
742+ hueShift *= colorfulness;
743+ satBoost *= colorfulness;
744+
737745 // Apply hue shift with wrapping
738746 CGFloat newH = h + hueShift;
739747 if (newH < 0 .0f ) { newH += 1 .0f ; }
You can’t perform that action at this time.
0 commit comments