Git Product home page Git Product logo

chameleon's People

Contributors

abeldvlpr avatar aekwan avatar alist avatar antranapp avatar bre7 avatar cascio avatar christian-fei avatar ddwang avatar dexter505 avatar dlo avatar manuelescrig avatar mbuchetics avatar obiyuta avatar philipperiegert avatar readmecritic avatar roccoma504 avatar stephenkopylov avatar swillsea avatar tbaranes avatar valexander avatar vicc avatar wimbledon avatar xumeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chameleon's Issues

Gradient - change angle (question)

First of all I want to thank you for this wonderful library that makes IOS development easier.

I would like to ask if Chameleon currently supports altering the angle of a linearGradient UIColor?

Thank you very much!

EXC_BAD_ACCESS Error

I am getting an EXC_BAD_ACCESS error on the following line in UIColor+ChameleonPrivate:

    *L = [LABValues[0] floatValue];

(L = NULL)

Why is this? I installed manually, not with CocoaPods (I just dragged the files into my project and imported Chameleon.h - no other errors)

How To: Update background gradient when UITableView scrolls

Hello! Awesome library btw. I ran into an issue which I think can easily be solved but my brain isn't working too right at the moment. I have a UITableView that has over a 100+ cells. Easy enough to apply a gradient to the TableView background. The problem starts when I scroll down the gradient doesn't scroll with the content. Basically it clips at a certain point and starts over again when the tableview cells are reused.

Here's my code. I use the tableView's frame...

- (void)updateGradient {
    UIColor *gradientBG = [UIColor colorWithGradientStyle:UIGradientStyleTopToBottom
                                            withFrame:self.tableView.frame
                                            andColors:@[[UIColor flatBlueColor], [UIColor lightGrayColor]]];

    [self.tableView setOpaque:NO];
    [self.tableView setBackgroundColor:[UIColor clearColor]];
    [self.view setBackgroundColor:gradientBG];
}

Gradient background and Swift

Attempting to style a gradient background using the code below renders a solid black background.

let colors:[UIColor] = [
   UIColor(red: 0/255, green: 118/255, blue: 162/255, alpha: 1.0),
   UIColor(red: 0/255, green: 85/255, blue: 116/255, alpha: 1.0)
]

self.backgroundColor = GradientColor(.TopToBottom, self.frame, colors)

Xcode 7
iOS9
Swift 2
SpriteKit

Use NSNumber literal instead of NSString literal

Currently in the UIColor class extension there are some class methods that return arrays of numbers representing RGB values for the flat colors. Currently these methods return arrays of strings:

return @[@"38", @"52", @"94", ...];

Which are then casted to NSNumber instances to get the float value:

[((NSNumber *)[[self redValues] objectAtIndex:i-1]) floatValue]

This is totally unnecessary! You can use the NSNumber literal syntax instead when creating the array:

return @[@38, @52, @94, ...];

And you can also use [[self redValues][i - 1] floatValue] to simplify the other set of code, although you probably ought not to constantly recreate the array in each iteration of the loop by calling the function to create the array over and over again.

NSInvalidArgumentException when using setGlobalThemeUsingPrimaryColor:withContentStyle:

I'm using iPhone 4S with iOS 7.1.1 installed.

My app works fine on 4S simulator, but when I run it in the real device, it crashes with the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzlesForSetter:'

When I remove setGlobalTheme, the app runs without problems.

It also works fine on a iPhone 5S with iOS 8.4.1 installed (real device).

Any hints on what may be causing the problem? I found related issues with the same error that pointed to disabling navBar translucence, but that didn't help me.

[Gradient color] - Invalid context 0x0 error

I'm facing an issue for the first time with the framework. I'm getting an invalid context error when trying to set a view's background color with a gradient color. Bellow is my code :

UIView * view = [[UIView alloc]initWithFrame:frame];
UIColor *lightYellow = [UIColor colorwithHexString:@"#98c168" alpha:0.9];
UIColor *darkYellow = [UIColor colorwithHexString:@"#f5eb08" alpha:0.9];
NSArray * yellowArray = [NSArray arrayWithObjects:lightYellow, darkYellow, nil];
view.backgroundColor = GradientColor(UIGradientStyleTopToBottom, frame, yellowArray);

The complete description of the error :

: CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Same error for : CGContextSaveGState , CGContextClipToRect, CGContextTranslateCTM, CGContextScaleCTM, CGContextDrawLinearGradient, CGContextRestoreGState, CGContextRestoreGState

Cocoapods alert for objc project

Hi,
is there any configuration in pod's file can define version for objc?
From Cocoapods:

[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add `use_frameworks!` to your Podfile or target to opt into using it.

Unexpected flatten behaviour

Shouldn't UIColor.yellowColor().flatten() return something "similar" at least to FlatYellow or FlatYellowDark instead of a black shade ?

Update: Works as intended. But for some reason UIViewControllers have black background as default

Wrong navigation bar color

The following line in AppDelegate makes navigationBar background and text color white.
Chameleon.setGlobalThemeUsingPrimaryColor(FlatMint(), withSecondaryColor: FlatBlue(), andContentStyle: UIContentStyle.Contrast)

+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme for:(UIColor *)color flatScheme:(BOOL)isFlatScheme;

It seems to me that the compiler is looking for the method:

+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme for:(UIColor *)color flatScheme:(BOOL)isFlatScheme;

but the method, found in NSArray+Chameleon.h/m is the following:

+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme with:(UIColor *)color flatScheme:(BOOL)isFlatScheme;

(with should be for)

Chameleon Shorthand in Swift

Is it possible to use the chameleon shorthand in Swift? It doesn't seem to be autocompleting in Xcode.

I installed the latest version using CocoaPods and added Chameleon/Chameleon.h to my bridging header.

bug with FXForm

when set [Chameleon setGlobalThemeUsingPrimaryColor:[UIColor flatBlueColor] withContentStyle:UIContentStyleContrast];

UIStatusBar and UITableViewCell display the wrong color.

Set up UIAppearance globally?

I read through documentation twice and there's no mention of setting global UIAppearance.
I'd like to set colors once in AppDelegate globally and not insert 'set color' into each and every one view controller.

What is the best practice for setting global UIAppearance or is there an example?

v2 questions

  1. Typo in the definition ? It's in the #pragma mark - Class Methods section
  2. In UIViewController+Chameleon.h the method flatify() is empty (Line 97)
  3. In findColorsOfImage(...), won't the NSArray and NSCountedSet have the same colors ?

Gradient don't fit with my view

Hi, i'm trying to add a gradient background for my UIView but, unfortunately, it don't fit with my desired width (screen width). The gradient contains black + transparent.

Code:

let colors:[UIColor] = [.blackColor(), .clearColor()]

fadeBackground.backgroundColor = GradientColor(.LeftToRight, fadeBackground.frame, colors)

*ps is my first project in iOS and i'm working with Swift

Portrait:

screen shot 2015-10-07 at 14 51 53

Landscape:

screen shot 2015-10-07 at 14 49 56

Switch to HSB colors

In my opinion it is better to use HSB colors as they are closer to human eye perception than RGB. When you have a distance between 2 colors it is more likely that their appearance is closer in HSB color space than in RGB.

Problem adding files

I'm having problems adding the files to my swift project. I keep getting errors in the short hand class. Can you please explaining a little bit more on how to integrate it?
Thank you

'Unrecognized selector' sent to class

I've been using Chameleon in my app for about 18 months and I haven't had a problem. I changed my app to use cocoapods (along with other updates) so I had to update all the #import statements from #import "Chameleon.h" to #import <ChameleonFramework/Chameleon.h>.

I'm now receiving an error when I use either ComplementaryFlatColor or ContrastColor. The error I receive is
+[UIColor colorWithComplementaryFlatColorOf:]: unrecognized selector sent to class 0x104909708 +[CATransaction synchronize] called within transaction +[CATransaction synchronize] called within transaction +[CATransaction synchronize] called within transaction *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor colorWithComplementaryFlatColorOf:]: unrecognized selector sent to class 0x104909708'

I have verified the Chameleon files imported properly because I can โŒ˜-click either macro and it takes me to the ChameleonMacros.h file and their #define statement. I've confirmed that Chameleon.h imports the macro file. I've set a breakpoint on the line + (UIColor *)colorWithComplementaryFlatColorOf:(UIColor *)color as well as + (UIColor *)colorWithComplementaryFlatColorOf:(UIColor *)color withAlpha:(CGFloat)alpha but the breakpoints are not hit.

Here is my code and I'll explain the relevant parts below:
screen shot 1

The colorHome variable is a UIColor. The self.homeTeamName.backgroundColor is the background color of a UILabel. I thought I might be sending an empty color to the function so I checked colorHome and verified it contained a color:
screen shot

All of this exact same code worked prior to moving to cocoapods and for various reasons I don't/can't move back to the way the app used to be written. Can you please provide some guidance on what I need to look for to resolve this issue? Also, I'm not sure why I started to receive the +[CATransaction synchronize] called within transaction errors, either. I haven't seen those errors until now so I think it's related. Thanks.

Add nullability annotations

Doesn't seem like necessary (Most values appear to be non-null and they are implicitly unwrapped optionals in Swift unless stated otherwise by annotations)

Error in swift project

I read the documentation and did the installation for cocoapods and import for my project the ChameleonShorthand.swift, when build the project give me the following error:

/ChameleonShorthand.swift:41:38: Use of undeclared type 'UIShadeStyle'
/ChameleonShorthand.swift:49:35: Use of undeclared type 'UIGradientStyle'
/ChameleonShorthand.swift:65:36: Use of undeclared type 'ColorScheme'
/ChameleonShorthand.swift:58:12: Use of unresolved identifier 'ChameleonStatusBar'

Another alert that the xcode this giving is:

/ChameleonFramework/Pod/Classes/Objective-C/UIColor+Chameleon.m:374:9: Value stored to 'backgroundColor' is never read

Can you help me?
Thanks a lot

Forcing hidden hairline in navigationBars

The current version of Chameleon forces hidden hairline in all navigationBars throughout an app. While for some instances this is correct, I use Chameleon mainly for flat colors and missing hairline in navigation bars really messes up my UI. Is it necessary to force the hairline to be hidden?

Here's the code UINavigationController+Chameleon.m:

- (void)chameleon_viewDidLoad {
    [self chameleon_viewDidLoad];

    UIView *heairlineImageView = [self findHairlineImageViewUnder:self.navigationBar];
    if (heairlineImageView) {
        heairlineImageView.hidden = NO; // I changed it from YES 
    }
}

Other than that this is an awesome framework! Thanks! :D

Updating Swift to 2.0

Hi @bre7!

Just updated Chameleon to 2.0. There might be some conflicts with Swift Macros though since several have been deprecated. It would be awesome if you can check it out real quick. Also if you have time, could you add some Swift examples for the new features in the documentation! Thanks!!! ๐Ÿ˜ƒ

Unexpected results with GradientColor

 [[UINavigationBar appearance] setBarTintColor:GradientColor(UIGradientStyleLeftToRight,
                                                                    CGRectMake(0, 0, 1024, 64),
                                                                    (@[FlatGreenDark, FlatGreen]))];

The result is a dark gray navigation bar.

duplicate definition of category

I use 'EDColor' and 'ChameleonFramework' in pod, Could add a prefix to category 'CIELAB' on interface 'UIColor' ?
iphonesimulator/ChameleonFramework.framework/Headers/UIColor+CIELAB.h:33:12: warning: duplicate definition of category 'CIELAB' on interface 'UIColor'
@interface UIColor (CIELAB)

I want to take the time to thank the following individuals...

I want to take the time to thank the following individuals...

@aekwan @alist @bre7 @cascio @ddwang @jmhooper @peacemoon @saullopez @sfader @smokyonion & @jherran

I've been busy working on a separate project for the last couple of months, which prevented me from being as involved with Chameleon as I would have liked. I feel like I never had the change to truly thank all of you for taking the time to check out Chameleon and contribute to it. Your contributions / pull requests / comments / and advice have definitely helped out. Cheers to all of you for truly being amazing! ๐Ÿป๐ŸŽ‰

I figured the least I could do was add all of you to the Special Thanks section, while also giving you credit for fixes in the Change Log section.

Thank you

Again thank you for helping out, and good luck on all your projects!

๐ŸŽˆ๐ŸŽˆ๐ŸŽ‰๐Ÿ™Œ๐Ÿ˜ƒ๐Ÿป๐Ÿ‘๐ŸŽŠ๐ŸŽˆ๐ŸŽˆ

Best,
Vicc

ColorsFromImage returns white only

Hello,

the above function does not work on a given image, neither with both true and false for the parameter isFlatScheme. The AverageColor function works fine on the same image.

What could lead to this problem?

GRADIENTSTYLE NOT SELF EXPLANITORY

USUALLY THE INPUT OF A CERTAIN VARIABLE LIKE "GRADIENTSTYLE" STARTS WITH THE WORD "GRADIENTSTYLE" INSTEAD OF JUST "LINEARLEFTTORIGHT"

CGContextDrawImage leaking?

Love the framework, but we're running into an issue where it looks like Chameleon's colour-generation is leaking.

We're using the +arrayOfColorsFromImage:withFlatScheme:(BOOL)isFlatScheme to generate complementary colours around our main image. Calling this even around 7 times resulting in our persistent memory usage doubling.

When I dig into how the method works internally, I'm noticing that removing the call to CGContextDrawImage from UIColor+ChameleonPrivate.m:50, the high memory usage ceases.

Is anyone able to replicate this?

flatten bug

color.flatten calls colorWithFlatVersionFrom(self), then [color getLightness:nil valueForA:nil valueForB:nil alpha:&colorAlpha];. Inside getLightness there's this code:

*L = [LABValues[0] floatValue];
*A = [LABValues[1] floatValue];
*B = [LABValues[2] floatValue];

but they are all nil

UIMenuViewController button style

png

UIColor *c = [UIColor colorWithGradientStyle:UIGradientStyleRadial withFrame:CGRectMake(0, 0, 960, 960) andColors:@[[UIColor flatBlueColor], [UIColor flatPowderBlueColor]] ];
[Chameleon setGlobalThemeUsingPrimaryColor:c withSecondaryColor:c andContentStyle:UIContentStyleLight];

button is ugly

SFSafariViewController looks weird

Hi,

SFSafariViewController views presented in apps using Chameleon are using part of the color scheme, and they do not look ok.

For instance, to the demo app I added an IBAction to the example button with the code:

@IBAction func openSafari(sender: AnyObject) {
     if #available(iOS 9.0, *) {
         let safariView = SFSafariViewController(URL: NSURL(string: "https://duckduckgo.com")!)
         self.presentViewController(safariView, animated: true, completion: nil)
     }
 }

When clicking the button the presented SFSafariViewController looks:
screen shot 2015-10-14 at 6 15 31 pm

You can notice the URL bar and the done button have the background color, but the rest of the navbar and status bars have the standard grey.

Is there a way to have the SFSafariViewController fully themed or can I add an exception to leave SFSafariViewController with the default color schema?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.