Code Monkey home page Code Monkey logo

hexcolors's People

Contributors

andreaskaltenbach avatar ashpilenia avatar buscarini avatar cbrulak avatar cemaleker avatar chocochipset avatar chrene avatar cormacrelf avatar dlinsin avatar ems305 avatar holgersindbaek avatar jkirsteins avatar mludi avatar mrs- avatar revolter avatar troyharris avatar zackliston 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

hexcolors's Issues

Podspec isn't compatible with OSX

I don't know if you are controlling the podspec as well on cocoapods, but would be great if you could make it compatible with OSX as well!

Add cache for HexColors

Hello, Marius Landwehr

I think it's very useful to add a global cache for HexColors, like NSColor or UIColor, and I add it myself.

What do you think about it ?

Best regards!

Request - API Changes for 2.3.0

Since the API changed with the new version, according to semantic versioning, shouldn't the version number be bumped to 3.0.0? By not changing the major version, people who were depending on the old cocoa pod have had the pod automatically updated to the next minor version (2.3.0) and their projects are breaking. (This includes me).

Since the update to the APIs have broken my project, can we get at change log that explains the API changes for 2.3.0 and what I need to be looking at to migrate to the new version?

Thanks

Tonnes of warnings when using HexColors through Carthage

$ carthage update --platform iOS yields:

*** Fetching HexColors
...
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:30:14: warning: unused variable 'nilColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:37:14: warning: unused variable 'falseColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:44:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:45:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:52:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:53:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:60:14: warning: unused variable 'whiteColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:61:14: warning: unused variable 'whiteHexColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:68:14: warning: unused variable 'greyColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:69:14: warning: unused variable 'rgbColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:30:14: warning: unused variable 'nilColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:37:14: warning: unused variable 'falseColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:44:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:45:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:52:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:53:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:60:14: warning: unused variable 'whiteColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:61:14: warning: unused variable 'whiteHexColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:68:14: warning: unused variable 'greyColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:69:14: warning: unused variable 'rgbColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:30:14: warning: unused variable 'nilColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:37:14: warning: unused variable 'falseColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:44:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:45:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:52:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:53:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:60:14: warning: unused variable 'whiteColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:61:14: warning: unused variable 'whiteHexColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:68:14: warning: unused variable 'greyColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:69:14: warning: unused variable 'rgbColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:30:14: warning: unused variable 'nilColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:37:14: warning: unused variable 'falseColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:44:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:45:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:52:14: warning: unused variable 'whiteColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:53:14: warning: unused variable 'whiteHexColor' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:60:14: warning: unused variable 'whiteColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:61:14: warning: unused variable 'whiteHexColorAlpha' [-Wunused-variable]
project-dir/Carthage/Checkouts/HexColors/HexColorsTests/HexColorsTests.m:68:14: warning: unused variable 'greyColor' [-Wunused-variable]

Xcode 9.1 beta 2 warning

I am getting a new warning when moved to Xcode 9.1 beta 2

Swift Compiler Warning
HexColors.swift:74:21: 'characters' is deprecated: Please use String or Substring directly

Move to Swift

I want to rewrite the complete library in swift for easier support in swift only projects. For this I will bump this up to version 4.0.0 and it can be API breaking. It will support iOS, tvOS, watchOS and OS X and it will be complete documented.

ToDos

  • rewrite in swift
  • framework support
  • tvOS support
  • watchOS support
  • iOS support
  • OS X support
  • unit tests
  • complete documentation
  • create README with legacy support

Cannot use HexColors via Carthage

macOS: 10.15.6 (19G2021)
Xcode: 11.6 (11E708)
Carthage: 0.35.0

github "mRs-/HexColors" == 4.0.0

Using HexColors in both Swift and Objective-C

Failed to read file or folder at project-path/Carthage/Build/iOS/HexColors.franework: Error Domain=NSCocoaErrorDomain Code=259 "Cannot retrive binary file from bundle at file:///project-path/Carthage/Build/iOS/HexColors.franework/" UserInfo={NSLocalizedDescription=Cannot retrive binary file from bundle at file:///project-path/Carthage/Build/iOS/HexColors.franework/, NSLocalizedRecoverySuggestion=Does the bundle contain an Info.plist?}
Command PhaseScriptExecution failed with a nonzero exit code

Documentation typo

In your documentation you say import HexColors.h

I think you mean import HexColor.h

Lack of # shouldn't crash the app

I think the method should accept both @"#ffffff" and @"ffffff". I'd be more than happy to add this functionality and create a pull request.

Should we add support for alpha in the hex string?

for example

  • (HXColor *)colorWithAlphaHexString:(NSString *)hexString
    {
    // Check for hash and add the missing hash. E.g. # 80 FF FF FF
    if('#' != [hexString characterAtIndex:0])
    {
    hexString = [NSString stringWithFormat:@"#%@", hexString];
    }

    // check for string length
    assert(9 == hexString.length );

    NSString *alpha = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(1, 2)]];
    float alphaFloat = [[self class] hexValueToFloat:alpha];

    NSString *redHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(3, 2)]];
    unsigned redInt = [[self class] hexValueToUnsigned:redHex];

    NSString *greenHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(5, 2)]];
    unsigned greenInt = [[self class] hexValueToUnsigned:greenHex];

    NSString *blueHex = [NSString stringWithFormat:@"0x%@", [hexString substringWithRange:NSMakeRange(7, 2)]];
    unsigned blueInt = [[self class] hexValueToUnsigned:blueHex];

    HXColor *color = [HXColor colorWith8BitRed:redInt green:greenInt blue:blueInt alpha:alphaFloat];

    return color;
    }

  • (CGFloat)hexValueToFloat:(NSString *)hexValue
    {
    float value = 0.0;
    NSScanner *hexValueScanner = [NSScanner scannerWithString:hexValue];
    [hexValueScanner scanFloat:&value];

    return value;
    }

Assert crashes app

Line 33 in HexColor.m
assert(7 == hexString.length || 4 == hexString.length);

This crashes the app if the hexString is not the right length. I'd be nice if it just provided a default color instead of crashing. My solution:

    if (7 != hexString.length && 4 != hexString.length) {
        NSString *defaultHex    = [NSString stringWithFormat:@"0xff"];
        unsigned defaultInt = [[self class] hexValueToUnsigned:defaultHex];

        HXColor *color = [HXColor colorWith8BitRed:defaultInt green:defaultInt blue:defaultInt alpha:1.0];
        return color;
    }

It's not perfect, but I think providing a wrong color is a much better experience than crashing the app. Also, I think error handling belongs inside that library rather than outside of it.

Thanks

Hex string with alpha not converting correctly

I'm using this Pod in a new Mac app (targeting 10.11) and I discovered a weird issue while writing tests for my color extension.

NSColor.hx_colorWithHexString("#99999955")

This should return an RGB of 153,153,153. When it gets to hx_colorWith8BitRed it is trying to create an NSColor colorWithCalibratedRed using 153,153,85. This seems to work whenever I leave off the alpha characters, but is returning the wrong value for blue.

New Release

Hey can you release a new version of HexColors for the last 2 commits? Unfortunately I can't add HexColors as a dependency to my pod without xcodebuild complaining πŸ˜„ :

WARN  | xcodebuild:  HexColors/Sources/HexColors.swift:74:21: warning: 'characters' is deprecated: Please use String or Substring directly

Making matters worse the PodSpec spec won’t allow me to pin HexColors to the latest commit. So, yea.. This wont stop me from putting out a new version of my pod which depends on Hexcolors but it'd be nice to get rid of these warnings.

Support Objective-C

Please Support Objective-C. i use cocoapods to install this podspec, but it say must use "user_framework", when i add it ,some podspec contains static library will not be installed.

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.