4

I'm looking to achieve an effect like this one in Snapguide:

Snapguide image colors

They are getting main image color and blurring (not sure, but I looks like they are) it somehow. I think I saw somewhere that there is a similar option available in iOS 8, but I couldn't find it anywhere. So does anyone know how they do it, or how can I get a similar effect?

Also to note, I'm working on new Xcode for iOS 7 & 8 in Swift, but I don't think that matters much.

Stefan Salatic
  • 4,513
  • 3
  • 22
  • 30
  • 1
    Great question and answer. There's an absurd idea on this site that it's "not good to ask for advice on which package to use" - great QA like this show how silly that idea is. – Fattie Sep 01 '14 at 10:45

2 Answers2

7

To extract the dominant image color, check out ColorArt.

Once you get the dominant color, try setting the tint color of a UIVisualEffectView to the required color. Init the VisualEffectView with a UIBlurEffect.

let blur = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
blur.tintColor = /* yourColor */
blur.frame = view.frame
view.addSubview(blur)
aksh1t
  • 5,410
  • 1
  • 37
  • 55
  • 2
    I managed to get the desired effect by setting the views background to `ColorArt.primaryColor` and then applying the blur as subview. Thanks! – Stefan Salatic Sep 01 '14 at 10:53
  • This is only for iOS 8 or later! What about 7? – LLIAJLbHOu Feb 22 '15 at 21:12
  • @LLIAJLbHOu: ColorArt will work for iOS 7 and below. For getting the blur, you could either implement your own technique or use a 3rd party project like this one: [FXBlurView](https://github.com/nicklockwood/FXBlurView). Also check out [this](http://stackoverflow.com/questions/17055740/how-can-i-produce-an-effect-similar-to-the-ios-7-blur-view) SO question. – aksh1t Feb 23 '15 at 03:41
  • I take many errors when i copy ColorArt .h and.m files in the project. Why? – Gaby Fitcal Jul 08 '15 at 08:27
  • @GabyFitcal Check out this iOS port for ColorArt: https://github.com/vinhnx/ColorArt. – aksh1t Jul 08 '15 at 08:33
  • 1
    @aksh1t Setting the tint colour isn't changing the colour of the blur for me, any ideas? – Ryan Brodie Dec 01 '15 at 23:15
0

For getting effect like the screenshot you can use DBImageColorPicker. This component allows getting various kinds of main colors also additional primary text color and secondary text color.

d0ping
  • 462
  • 4
  • 16