How do you use let newSwiftColor = UIColor(red: 255, green: 165, blue: 0, alpha: 0)?
Since you're creating a new variable that contains a reference to a UIColor (newSwiftColor
), it would just be:
calcbutton.layer.borderColor = newSwiftColor.CGColor
Note that Colors in UIKit are specified using floats from 0..1 not ints from 0..255, so you need to divide all your RGB values by 255.0:
let newSwiftColor = UIColor(red: 34.0/255.0, green: 167.0/255.0, blue: 239.0/255.0, alpha: 0)
Wrong color when convert UIColor to CGColor
Colors in UIKit are specified using value is between 0 and 1 in float not int from 0 to 255, so you need to divide all your RGB values by 255.0.
let color = UIColor(red: 198.0/255.0, green: 35.0/255.0, blue: 80.0/255.0, alpha: 1.0)
Related Topics
Saving Already Created Live Photos
Why am I Getting Com.Facebook.Sdk.Login Error 308
Different Cell in Tableview Swift 3
Get Latitude and Longitude Center of Google Map
How to Check If a Nstimer Is Running or Not in Swift
Correct Way to Layout Swiftui (Similar to Autolayout)
How to Get the Today's and Tomorrow's Date in Swift 4
Giving Properties of a Uibutton to a Skspritenode in Spritekit
Blur Effect - Background Uitextfield
Auto Focus and Auto Exposure in Avfoundation on Custom Camera Layer
How to Convert Data Dictionary into an Array Swift
Display UI (Storyboard Possibly) with Broadcast UI Extension
Changing the Shape of a Uiview Border
How to Schedule a Same Local Notification in Swift