RGBColorSlider 0.1.2

RGBColorSlider 0.1.2

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.

  • By
  • Eric Appel

RGBColorSlider provides a dead simple way to add RGB sliders that dynamically respond to each other and change their appearances to give users an intuitive way to pick colors.


RGBColorSlider uses ARC and is targeted for iOS 7.0


RGBColorSlider is available through CocoaPods. To install it

  1. Add pod 'RGBColorSlider' to your Podfile
  2. In your terminal run $ pod install and open your workspace $ open yourApp.xcworkspace

To manually install, copy the Classes folder into your project.


To use RGBColorSlider in your project, you need to include the following:

#import "RGBColorSlider.h"
#import "RGBColorSliderDelegate.h"

Additionally, your view controller must adopt the RGBColorSliderDataOutput protocol, which has one required method.

@interface YourViewController () <RGBColorSliderDataOutlet>
- (void)updateColor:(UIColor *)color
    // ... Do something ...


To create a new RGBColorSlider, first you need to initialize a RGBColorSliderDelegate object

RGBColorSliderDelegate *delegate = [[RGBColorSliderDelegate alloc] init];

Then use the custom init method to create a slider

- (id)initWithFrame:(CGRect)frame sliderColor:(RGBColorType)color trackHeight:(float)height delegate:(id<RGBColorSliderDelegate>)delegate

Creating red, green, and blue sliders would look something like:

RGBColorSliderDelegate *delegate = [[RGBColorSliderDelegate alloc] init];
delegate.delegate = self;  

RGBColorSlider *redSlider = [[RGBColorSlider alloc] initWithFrame:CGRectMake(20, 140, 280, 44) sliderColor:RGBColorTypeRed trackHeight:6 delegate:delegate];
RGBColorSlider *greenSlider = [[RGBColorSlider alloc] initWithFrame:CGRectMake(20, 188, 280, 44) sliderColor:RGBColorTypeGreen trackHeight:6 delegate:delegate];
RGBColorSlider *blueSlider = [[RGBColorSlider alloc] initWithFrame:CGRectMake(20, 232, 280, 44) sliderColor:RGBColorTypeBlue trackHeight:6 delegate:delegate];  

[self.view addSubview:redSlider];
[self.view addSubview:greenSlider];
[self.view addSubview:blueSlider];

Note that you need to set the RGBColorSliderDelegate's delegate to self to enable reporting of the updated color when a slider value is changed.

In the example project, -updateColor: changes the background color of a UIView to display the current color based on each slider value.


  • Do I need to use all three sliders?

  • What about an Alpha slider?

  • -updateColor works but sometimes I need to get the current color without waiting for the user to interact with a slider. How can I fetch the current color at a specific part of my project?


How it works, design choices.
RGBColorType definition


RGBColorSlider is available under the MIT license. See the LICENSE file for more info.