yoavlt/LiquidFloatingActionButton

Change background color

XinwenCheng opened this issue · 5 comments

How could I change the background color of floating action button?

savsa commented

Go to LiquidFloatingActionButton.swift and look at:

@IBInspectable public var color: UIColor = UIColor(red: 36 / 255.0, green: 42 / 255.0, blue: 70 / 255.0, alpha: 1.0) { didSet { baseView.color = color } }

There you can change the rgb color value and whatnot to your liking.

In case anyone still needs to do this...
You can also set the color value on your instance of floating action button like this:

myFloatingActionButton.color = UIColor.green

Of course use your choice of color.

In my case, I have to give custom color so I used to like this using @japhethkosgei answer

floatingActionButton.color = UIColor(red:250.0/255.0, green:75.0/255.0, blue:150.0/255.0, alpha:1.0)

Thanks both @japhethkosgei and @NikhilGangurde very much!

Thanks both @japhethkosgei and @NikhilGangurde very much!

you're welcome!!