Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:14:39+00:00 2026-06-14T21:14:39+00:00

I have an UIColor object that will be the color for a bar in

  • 0

I have an UIColor object that will be the color for a bar in a bar chart graph. I would like to make this color into a linear gradient that will go from the color to a lighter version of that color and back to the initial color. I think CGGradientCreateWithColorComponents is the function for this but I’m not sure how to use it … How do I obtain the lighter version of my color ? and use it in the gradient. I’m fairly new to core graphics .

Thanks …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:14:41+00:00Added an answer on June 14, 2026 at 9:14 pm

    I use CAGradientLayer in the Quartz Core framework. It accepts an array of CGColorRef colors that can be used to form a gradient. Some example code is displayed below for handling a UIColor in color. You can modify the brightness or other HSB parameters to achieve what you want.

    CGFloat hue;
    CGFloat saturation;
    CGFloat brightness;
    CGFloat alpha;
    [ color getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha ]
    
    CAGradientLayer *gradient = [ CAGradientLayer layer ];
    gradient.frame = self.bounds;
    gradientColorsArray = [ NSArray arrayWithObjects:
        (id) [[ UIColor colorWithHue:1.0 saturation:1.0 brightness:1.0 alpha:1.0 ] CGColor],
        (id) [[ UIColor colorWithHue:1.0 saturation:1.0 brightness:0.75 alpha:1.0 ] CGColor],
         nil ];
    gradient.colors = gradientColorsArray;
    gradient.startPoint = CGPointMake(0.5f, 0.0f);
    gradient.endPoint = CGPointMake(0.5f, 1.0f);
    [ self.layer addSublayer:gradient ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read that dealloc for an object will be called, only if retain
I have a bunch of lines like this on my app UIColor *myColor =
have written this little class, which generates a UUID every time an object of
I have created a UIColor object and want to set the colors before drawing
I have a little UIView object, CircleColorView.m, that simply creates a view with a
I want to simply have a loop so that an object continuously moves across
In Cocos2d, I have read that [[[[CCDirector sharedDirector] openGLView] window] addSubview:someButton]; will add a
I have a UIView for which I would like to set its borderColor: UIView
Suppose I have a UIColor that I want to use across every view controller
I have an entity called Color that has R,G,B stored, and a subclass that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.