An Xcode plugin to improve dealing with colors in your project

Related tags

Image Crayons
Overview

Logo Join the chat at https://gitter.im/Sephiroth87/Crayons

Crayons is an Xcode7 plugin with various features that improve working with colors in your projects

##Code palettes (iOS only)

CodePalettes

You can share palettes of colors from your source files, and use them directly in Interface Builder, without having to manually recreate them in the Color Picker. And if you decide to change a color, you just need to change it's implementation. Colors are generated dynamically, so you can use any method or calculation you need. Because of that, project has to built to get updated colors, so it might take a while before they are updated in IB after a code change.

####Usage Define a palette by adding the class method

	+ (NSString *)paletteName
   class func paletteName() -> String 

to any class (Class has to derive from NSObject at some level, so no pure Swift classes at the moment). To define a color, add a class method or variable with any name that returns UIColor, for example

	+ (UIColor *)colorName
   class func colorName() -> UIColor
   class var colorName: UIColor

Only methods with no parameters are supported at the moment, and only UIColors in the RGB and White color space (so no colorWithPatternImage:)

You can then create a category/extension of you palette class, to create a separate palette with the same name plus the category name (look at GooglePalette and GooglePalette+Accents in the example project)

UIColor categories (like Chameleon will also generate palettes automatically.

Look at the example project for more infos.

##Upcoming features

  • Colors validation (show IB warnings if using colors not defined in any palette)
  • OSX support?
  • More ways to define palettes/colors
  • Show status of colors generations / indexing
  • Any feature you think could be useful? Contact me (@Sephiroth87)

##Installation

  • Clone and build the project
  • Use Alcatraz

Either way, restart Xcode to make it load

##Release notes ###1.3

  • Add support for Swift class variables

###1.2

  • Xcode 7.3 support
  • Improved internal logic + bugfixes

###1.1

  • You can now use categories/extensions for secondary palettes, and automatic UIColor palettes

###1.0

  • Initial Release
  • Code palettes for iOS

##License Copyright (c) 2015. Fabio Ritrovato

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Does not seem to work with Xcode 7.3 beta

    Does not seem to work with Xcode 7.3 beta

    Does not seem to work with Xcode 7.3 beta (7D129n), the colour pallet menu in Xcode just shows system colours and seems to ignore my UIColor categories.

    Here is what is printed in the Console:

    `04/02/2016 13:17:27.037 Xcode[86084]: [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-10139/DVTKit/ViewControllers/DVTControllerContentView.m:82 Details: DEPRECATED: -[DVTControllerContentView_ControlledBy_IBInspectorViewController viewController] -> IBInspectorViewController 0 -[DVTControllerContentView viewController](in DVTKit) 1 -[NSObject(NSKeyValueCoding) valueForKey:](in Foundation) 2 -[DVTColorPickerPopUpButton(Crayons) inspectorViewController] at /Users/cameron/Library/Application Support/Alcatraz/Plug-ins/Crayons/Crayons/Classes/DVTColorPickerPopUpButton+Crayons.m:123 (in Crayons) 3 -[DVTColorPickerPopUpButton(Crayons) p_populateColorsMenu] at /Users/cameron/Library/Application Support/Alcatraz/Plug-ins/Crayons/Crayons/Classes/DVTColorPickerPopUpButton+Crayons.m:27 (in Crayons) 4 -[DVTAbstractColorPicker showColorsMenu](in DVTKit) 5 -[DVTColorPickerPopUpButton mouseDown:](in DVTKit) 6 -[NSWindow _handleMouseDownEvent:isDelayedEvent:](in AppKit) 7 -[NSWindow _reallySendEvent:isDelayedEvent:](in AppKit) 8 -[NSWindow sendEvent:](in AppKit) 9 -[IDEWorkspaceWindow sendEvent:](in IDEKit) 10 -[NSApplication sendEvent:](in AppKit) 11 -[IDEApplication sendEvent:](in IDEKit) 12 -[NSApplication run](in AppKit) 13 NSApplicationMain (in AppKit) 14 0x000000010752d3c3 (in Xcode) 15 start (in libdyld.dylib)

    Object: <DVTControllerContentView_ControlledBy_IBInspectorViewController: 0x7fb9d1fe01e0> Method: -viewController Thread: <NSThread: 0x7fb9ca418370>{number = 1, name = main} Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.

    04/02/2016 13:17:27.166 IBDesignablesAgentCocoaTouch[86162]: assertion failed: 15C50 13E5191d: libxpc.dylib + 27596 [05A59E46-3773-3B05-AA95-5EA031AC5F81]: 0x8d 04/02/2016 13:17:27.167 IBDesignablesAgentCocoaTouch[86162]: BUG in libdispatch: 15C50 - 1076 - 0x2

    04/02/2016 13:17:27.167 IBDesignablesAgentCocoaTouch[86162]: BUG in libdispatch client: kevent[EVFILT_VNODE] add: "Bad file descriptor" - 0x9

    04/02/2016 13:17:27.177 IBDesignablesAgentCocoaTouch[86162]: assertion failed: 15C50 13E5191d: libxpc.dylib + 27596 [05A59E46-3773-3B05-AA95-5EA031AC5F81]: 0x8d`

    opened by cameroncooke 27
  • Support for public class var

    Support for public class var

    I'm trying to use this with PaintCode, which can export StyleKit classes that have colors. The only modification necessary to the PaintCode export file is to add the paletteName class func. I'm going to send an email to the PaintCode team to see if they might be able to add the paletteName func to their export template, but if not adding it manually isn't too difficult. As an aside, it would be cool if Crayons could detect a StyleKit file and index it with a standard name without needing the paletteName func.

    Aside from that, PaintCode exports colors like this:

    //// Cache
    
    private struct Cache {
        static let themeRedColor: UIColor = UIColor(red: 0.835, green: 0.208, blue: 0.282, alpha: 1.000)
        static let themeGreenColor: UIColor = UIColor(red: 0.090, green: 0.592, blue: 0.467, alpha: 1.000)
        static let themeYellowColor: UIColor = UIColor(red: 0.965, green: 0.620, blue: 0.439, alpha: 1.000)
    }
    
    //// Colors
    
    public class var themeRedColor: UIColor { return Cache.themeRedColor }
    public class var themeGreenColor: UIColor { return Cache.themeGreenColor }
    public class var themeYellowColor: UIColor { return Cache.themeYellowColor }
    

    But Crayons needs this:

    public class func testColor() -> UIColor { return Cache.themeGreenColor }
    

    Is there a way to get Crayons to see these class vars and index them accordingly?

    opened by Vortec4800 2
  • Palettes are duplicated if color class is in multiple targets

    Palettes are duplicated if color class is in multiple targets

    My Color class is included in my main project's target but also in an extension

    I am seeing the palettes duplicated and I imagine its because both targets have been built, each added the palettes

    screen shot 2016-04-01 at 1 48 51 pm

    opened by fraserscottmorrison 1
  • Crayons plugin breaks the xcodebuild

    Crayons plugin breaks the xcodebuild

    After installing this plugin xcodebuild cannot find provisioning profiles for projects. Seems like it tries to find provisioning profiles in a wrong path. xcodebuild fails with following errors:

    Error:CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 9.2' Warning:Code Sign warning: Specified PROVISIONING_PROFILE (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) not found and no CODE_SIGN_IDENTITY specified. Ignoring PROVISIONING_PROFILE for now. This will become an error in the future.

    Error:Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”, however, no such provisioning profile was found.

    After removing the plugin xcodebuild builds projects successfully.

    Xcode version: 7.2.

    opened by eugeneego 1
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    Sephiroth87/Crayons now has a Chat Room on Gitter

    @Sephiroth87 has just created a chat room. You can visit it here: https://gitter.im/Sephiroth87/Crayons.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Change color value

    Change color value

    "And if you decide to change a color, you just need to change it's implementation".

    Does that mean if you decide to update one of your color it should be taken into account ?

    Using Xcode 7.3.1, when I update/change one of my palette color value, all my components that were using that color don't use the new color value. I am not sure if Crayons is supposed to do that, or just creates colors shortcuts in the interface though.

    opened by false 1
  • Sorting idea

    Sorting idea

    Just an idea, but what about, instead of sorting the list of colors by name, they were sorted by color spectrum (somehow).

    Eg in my screen shot, the sorting is good, but it'd be better if it went "Gray Light", "Gray" then "Gray Dark"

    screen shot 2016-04-01 at 2 01 32 pm

    opened by fraserscottmorrison 2
  • Nested classes aren't listed

    Nested classes aren't listed

    Wanted to leave this as a separate issue:

    I like to have one global class with nested extensions for separate configuration panels. It's an intellisense pattern leftover from VS that I've grown to enjoy. With that said, nested classes in the palette pattern you've defined aren't shown in the Storyboard.

    This might be intentional and not a bug, but I was curious about it nonetheless.

    Thanks!

    opened by bdrelling 1
  • Doesn't update storyboard when backing method changes

    Doesn't update storyboard when backing method changes

    I really love the idea of this plugin, but I thought the intent is to be able to maintain colors for both the code and the storyboards in one place? If I change the code in the method, the colors stay the same in the storyboard with no change. I can't tell if this is a bug, a feature that is soon to be implemented, or if I'm misunderstanding the purpose of the plugin.

    As it stands right now, Xcode offers custom palettes by going to the Colors menu, clicking the Palettes option, then the cog, and selecting "New..." You can then configure the color in the color picker and add it with the + button on this menu. Similarly, you can't update the color in the palette and expect it to change on the storyboard.

    Hope this makes sense. Just trying to get some insight into the development of this app and see what we can expect.

    opened by bdrelling 1
  • Doesn't work, menu entry doesn't show up

    Doesn't work, menu entry doesn't show up

    I tried to install via Alcatraz and opened the Main.storyboard in the Example app. In the color picker no custom entry shows up.

    I also tried to install manually (Just hit Cmd-R and another copy of Xcode opens) => same problem.

    opened by futuretap 19
Owner
Fabio Ritrovato
Fabio Ritrovato
Makes dealing with images buttery smooth.

ImageButter Image viewer for iOS that supports WebP. What is WebP? Find out more here. You can find more about why we created this here. Features Anim

Dollar Shave Club 397 Nov 19, 2022
Xcode plugin that brings ⇧⌘T from AppCode over to Xcode

Aviator An Xcode Plugin that brings ⇧⌘T over to Xcode This minimal plugin allows you to use the key combo ⇧⌘T to toggle between source and test files.

Mark Sands 29 Aug 18, 2018
Read colors from Xcode assets file.

XcodePalette Read colors from Xcode assets file. How to Use Download the XcodePalette.Executable.zip of the latest release. Extract the XcodePalette U

iMoeNya 0 Nov 12, 2021
Cordova-plugin-saveimage - This plugin helps you save images

cordova-plugin-saveimage This plugin helps you save images on iOS/Android Instal

Bernat 2 May 11, 2022
Xcode plugin that moves the instruction pointer to the selected line

SFJumpToLine Xcode plugin that moves the instruction pointer to the selected line. Install: Install via Alcatraz Or clone and build the project, then

Simone Ferrini 9 Jan 14, 2021
An Xcode plugin for manually symbolicating crash logs

CrashSymbal An Xcode plugin for manually symbolicating crash logs Install Build the project to install the plugin. The plugin gets installed in /Libra

Julian F. Weinert 38 Jun 3, 2021
XcodeColorSense - An Xcode plugin that makes working with color easier.

XcodeColorSense An Xcode plugin that makes working with color easier. Inspired by ColorSense-for-Xcode with extra care for Hex color Features Show col

Khoa 77 Jul 1, 2022
A Xcode plugin to add highlight to the instances of selected symbol.

Auto Highlight Symbol About Xcode 8 Xcode 8 does't support plugins anymore, but there is a workaround, use at your own risk. Xcode can highlight insta

Nelson 83 Jan 3, 2023
An Xcode 7 plugin to build and run an app across multiple iOS devices with one click.

RunEverywhere Xcode Plugin Overview An Xcode 7 plugin to build and run an app across multiple iOS devices with one click. Gone are the days of manuall

Eric Mika 322 Sep 7, 2022
Xcode plugin to open the GitHub page of the commit of the currently selected line in the editor window.

Show in GitHub / BitBucket Xcode plugin to open a related Github or BitBucket page directly from the Xcode editor code window. Installs easily through

Lars Schneider 242 Jul 20, 2022
Xcode plugin for filtering the console area.

MCLog This plugin lets you easily filter the Xcode console log output. While you can already search the text in the console log output you are still l

Michael Chen 591 Oct 31, 2022
Fetches the most dominant and prominent colors from an image.

UIImageColors iTunes style color fetcher for UIImage and NSImage. It fetches the most dominant and prominent colors. Installation Manual Copy UIImageC

null 3.2k Jan 1, 2023
Create complementary gradients generated from dominant and prominent colors in supplied image. Inspired by Grade.js

ComplimentaryGradientView Create complementary gradients generated from dominant and prominent colors in supplied image. Inspired by Grade.js ❤️ .all

George Kye 728 Dec 17, 2022
The repository for a command line / build pipeline tool for generating colors from a human-readable text file that designers can also use.

ColorPaletteGenerator ColorPaletteGenerator is a tool that takes a human-readable input file describing a color palette, and generates the associated

horseshoe7 0 Dec 7, 2021
ColorKit makes it easy to find the dominant colors of an image

ColorKit ColorKit is your companion to work with colors on iOS. Features Installation Sample Project Contributing License Features Dominant Colors Col

Boris Emorine 570 Jan 5, 2023
Terminal Colors for Swift

Terminal string styling for Swift Colors is a clean and focused solution for string styling in Swift. Usage import Colors print(Colors.blue("Blue str

Paulo Tanaka 94 Sep 9, 2022
Metazoom - A virtual camera plugin to pixellatedly share your screen

MetaZoom A virtual camera plugin to pixellatedly share your screen. See LICENSE.

Sahil Lavingia 22 Jan 4, 2023
A VisionCamera Frame Processor plugin for fast buffer resizing

vision-camera-resize-plugin A VisionCamera Frame Processor Plugin for fast buffer resizing. By resizing buffers to a smaller resolution, you can achie

Marc Rousavy 16 Aug 10, 2022
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021