UIColor(MBToolbox) Category Reference

Declared in UIColor+MBToolbox.h

Overview

A class extension for UIColor that exposes additional color information.

– isOpaque

Determines whether the receiver represents an opaque color.

- (BOOL)isOpaque

Return Value

YES if the receiver is an opaque color; NO otherwise.

Discussion

A color is opaque if it has an alpha channel value of 1.0. A color with an alpha value less than 1.0 requires alpha blending and is not opaque.

Declared In

UIColor+MBToolbox.h

– isDark

Determines whether the receiver represents a dark color.

- (BOOL)isDark

Return Value

YES if the receiver is a dark color; NO otherwise.

Discussion

A color is considered dark if its brightness value is less than 0.5.

Declared In

UIColor+MBToolbox.h

– highlightColor

Returns a new UIColor instance containing an appropriate highlight color for the receiver by adjusting the receiver’s brightness.

- (nonnull UIColor *)highlightColor

Return Value

A highlight color based on the receiver.

Discussion

The highlight color will be a brighter version of the receiver if the receiver is a dark color; if the receiver is not a dark color, the highlight color will be a darker version of the receiver.

Declared In

UIColor+MBToolbox.h

– colorWithBrightnessAdjustedByFactor:

Returns a new UIColor instance by adjusting the brightness value of the receiver by a given factor.

- (nonnull UIColor *)colorWithBrightnessAdjustedByFactor:(CGFloat)adjustFactor

Parameters

adjustFactor

The adjustment factor.

Return Value

The adjusted color.

Discussion

The returned color will match the hue, saturation and alpha of the receiver, but the brightness value will be multiplied by the adjustment factor.

Declared In

UIColor+MBToolbox.h