What is the correct way to update RGB values of a colorLiteral in Xcodet?

Viewed 132

Swift provides color literals which can be written as follows:

#colorLiteral(red: 1, green: 0.8431372549, blue: 0.8235294118, alpha: 1)

After this line of code is written, Xcode transforms it into a color image in the code as shown below.

enter image description here

Once it is has been automagically transformed into this image, how can I edit the specific RGB values? (I realize I can use the color picker to pick my own color, but I would like to use specific RGB values, not try to pick a color in the UI.)

enter image description here

So the question is, how do you update the color to specific RGB values without deleting and re-writing the color literal?

1 Answers

Double click on the little square, this will pop up:

enter image description here

press "Other". The usual macOS color picker shows up. You can then go to the second tab, and select the RGB sliders option. There is also an option to enter floating point values if you click on the gear icon:

enter image description here

Related