0

I added a UIButton to my view. It's a regular button of system type, default config and plain title, all default values. I set the text color property in IB to the RGB values shown below: r68, g66, b62 UIButton title color

I made a custom color programmatically with the same RGB values:

extension UIColor {

    class var customColor: UIColor {
        return UIColor(red: 68/255, green: 66/255, blue: 62/255, alpha: 1)
    }
}

Why are the button's RGB values different when I check them in my view controller than what I set them to be in IB (identical to my custom color RGB values)?

// UIExtendedSRGBColorSpace 0.33669 0.327454 0.310221 1
myButton.titleColor(for: .normal)!.description)

// UIExtendedSRGBColorSpace 0.266667 0.258824 0.243137 1
UIColor.customColor.description

Shouldn't they be the same? If not, how do I get them to be the same?

Aaron
  • 6,466
  • 7
  • 37
  • 75

0 Answers0