diff --git a/CHANGELOG.md b/CHANGELOG.md index 78672a3..510d8dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ x.y.z Release Notes (yyyy-MM-dd) ============================================================= +2.1.1 Release Notes (2026-06-04) +============================================================= + +### Fixed + +* Toned down the tapped tint color calculations from producing oversaturated colors. + 2.1.0 Release Notes (2026-05-27) ============================================================= diff --git a/TORoundedButton.podspec b/TORoundedButton.podspec index d39782d..e6b9ba4 100644 --- a/TORoundedButton.podspec +++ b/TORoundedButton.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TORoundedButton' - s.version = '2.1.0' + s.version = '2.1.1' s.license = { :type => 'MIT', :file => 'LICENSE' } s.summary = 'A high-performance button control with rounded corners for iOS.' s.homepage = 'https://github.com/TimOliver/TORoundedButton' diff --git a/TORoundedButton/TORoundedButton.h b/TORoundedButton/TORoundedButton.h index fc7a1a3..5624274 100644 --- a/TORoundedButton/TORoundedButton.h +++ b/TORoundedButton/TORoundedButton.h @@ -117,7 +117,10 @@ IB_DESIGNABLE @interface TORoundedButton : UIControl /// (Defaults to off with 1.0f). @property (nonatomic, assign) IBInspectable CGFloat tappedTextAlpha; -/// Taking the default button background color apply a brightness offset for the tapped color +/// The color of the button's rounded background shape. Applied to `.solid` and `.glass` styles. +@property (nonatomic, strong, nullable) UIColor *tintColor; + +/// Taking the default button background color apply a brightness offset for the tapped color /// (Default is 0.25f. Set 0.0 for off). @property (nonatomic, assign) IBInspectable CGFloat tappedTintColorBrightnessOffset; diff --git a/TORoundedButton/TORoundedButton.m b/TORoundedButton/TORoundedButton.m index 0403421..4921174 100644 --- a/TORoundedButton/TORoundedButton.m +++ b/TORoundedButton/TORoundedButton.m @@ -68,6 +68,10 @@ @implementation TORoundedButton { UIImpactFeedbackGenerator *_impactGenerator; } +// We redlared `tintColor` in the header to make it more obvious that's how +// you control the background color. Skip synthesizing any accessors in here. +@dynamic tintColor; + #pragma mark - View Creation - - (instancetype)init { @@ -734,6 +738,14 @@ - (UIColor *)_brightnessAdjustedColorWithColor:(UIColor *)color amount:(CGFloat) brightnessAdd = 0.18f * amount; } + // Greys and other near-neutral colours carry a meaningless hue plus a faint + // undertone (e.g. systemGray leans slightly blue). Boosting their saturation + // amplifies that undertone into a visible tint, so scale the hue/saturation + // changes by how saturated the source already is — leaving brightness alone. + const CGFloat colorfulness = fminf(s / 0.15f, 1.0f); + hueShift *= colorfulness; + satBoost *= colorfulness; + // Apply hue shift with wrapping CGFloat newH = h + hueShift; if (newH < 0.0f) { newH += 1.0f; }