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 711417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:43:58+00:00 2026-05-14T04:43:58+00:00

Let’s say I’ve got the colour FF0000, which is red. Finding a darker colour

  • 0

Let’s say I’ve got the colour FF0000, which is red. Finding a darker colour is easy, I just type maybe CC instead of the FF, but let’s say I’ve got the colour AE83FC, which is a complicated colour, how the heck would I find a lighter or darker version of it automatically?

I figured the easy way to do this is to convert my RGB to HSB [Hue, Saturation, Brightness]

How would I do that in Objective-C?

Let’s say I’ve got a RGB which is: 1.0, 0.0, 0.0. That’s red.

CGFloat r = 1.0;
CGFloat g = 0.0;
CGfloat b = 0.0;

How would I convert that to HSB and then transform the colors and make it go back to RGB to I can use CGContextRGBSetFillColor?

Are there any HSB functions?

Please help. 🙂

  • 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-05-14T04:43:59+00:00Added an answer on May 14, 2026 at 4:43 am

    First, please be aware that three numbers don’t describe a color, three numbers together with a colorspace do. RGB isn’t a colorspace, it’s what’s called a color model. There are lots of colorspaces with the RGB model. So ((1,0,0), sRGB) is a different color than ((1,0,0), Adobe RGB). Are you aware of how string encodings work, where a bunch of bytes by itself is not a string? It’s a lot like that. It’s also similar in that you’re kind of asking for trouble whenever you want to look at the component values, because it’s an opportunity for messing up the colorspace handling.

    Sorry, cannot help myself. Anyway, I’ll answer the question as if your original color was ((1,0,0), Generic RGB).

    NSColor *color = [NSColor colorWithCalibratedRed:1 green:0 blue:0 alpha:1];
    NSLog(@"hue! %g saturation! %g brightness! %g, [color hueComponent], [color saturationComponent], [color brightnessComponent]);
    

    and on the other hand,

    NSColor *color = [NSColor colorWithCalibratedHue:h saturation:s brightness:b alpha:1];
    NSLog(@"red! %g green! %g blue! %g, [color redComponent], [color greenComponent], [color blueComponent]);
    

    These fooComponent methods do not work with all colors, only those in two specific colorspaces, see docs. You already know you’re good if you created the colors yourself with the methods above. If you have a color of unknown provenance, you can (attempt to) convert it to a colorspace in which you can use those component methods with -[NSColor colorUsingColorspaceName:].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a method in java, which looks up a user in
Let's say I'm making a tool to help epicureans keep track of which delicacies
Let's say I got a Map<String, String> and I wanna remove all the entries
Let's say I have a dataset, which can be neatly classified using weka's J48
Let's say I'm writing a Windows Forms (.NET Framework 3.5) application which shows the
Let's say you have a class called Customer, which contains the following fields: UserName
Let's say I've got a collection of 10 million documents that look something like
Let's say we have this code: <form action='' method='POST' enctype='multipart/form-data'> <input type='file' name='userFile'><br> <input
Let's say I've got n properties (pairs key-value) that are either dates, numbers or
Let's say I don't have photoshop, but I want to make pattern files (.pat)

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.