Jump to content

Colors—convert color formats & access the OS X color panel


Recommended Posts

Posted

Whatever you like best! If you want to paste into the forums, do that; Sharetext is a great service for this purpose, since there's nothing private in the output.

 

However you like to share it is fine with me ;)

 

Cheers :)

 

 

Great, here is the output:

 

Named Color—Red

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors name to hex" arg="hex|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>#ff0000</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors name to hsl" arg="hsl|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>hsl(0, 100%, 50%)</title><subtitle>HSL format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors name to name" arg="name|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>red</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors name to rgb" arg="rgb|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(255, 0, 0)</title><subtitle>RGB format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors name to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(100%, 0%, 0%)</title><subtitle>RGB percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item></items>

 

----------

Named Color—No Match

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors picker" arg="pick|name" valid="yes" autocomplete=""><title>No Color Matches</title><subtitle>Action this item to reveal the OS X color picker</subtitle><icon>icon.png</icon></item></items>

 

----------

HSL

 

 

Notice: Undefined offset: 3 in /Users/kirklove/Dropbox/Alfred Sync Folder/Alfred.alfredpreferences/workflows/user.workflow.5C53E129-54B2-4086-A9C6-8E4990ACF8E6/colors.php on line 30

<?xml version="1.0"?>

<items><item uid="tylereich.colors hsl to hex" arg="hex|{"r":1,"g":1,"b":0,"a":1}" valid="yes" autocomplete=""><title>#ffff00</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff00ff.png</icon></item><item uid="tylereich.colors hsl to hsl" arg="hsl|{"r":1,"g":1,"b":0,"a":1}" valid="yes" autocomplete=""><title>hsl(60, 100%, 50%)</title><subtitle>HSL format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff00ff.png</icon></item><item uid="tylereich.colors hsl to name" arg="name|{"r":1,"g":1,"b":0,"a":1}" valid="yes" autocomplete=""><title>yellow</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff00ff.png</icon></item><item uid="tylereich.colors hsl to rgb" arg="rgb|{"r":1,"g":1,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(255, 255, 0)</title><subtitle>RGB format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff00ff.png</icon></item><item uid="tylereich.colors hsl to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":1,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(100%, 100%, 0%)</title><subtitle>RGB percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff00ff.png</icon></item></items>

 

----------

HSLA

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors hsl to hex" arg="hex|{"r":1,"g":1,"b":0,"a":"0.5"}" valid="yes" autocomplete=""><title>#ffff0080</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff0080.png</icon></item><item uid="tylereich.colors hsl to hsl" arg="hsl|{"r":1,"g":1,"b":0,"a":"0.5"}" valid="yes" autocomplete=""><title>hsl(60, 100%, 50%, 0.5)</title><subtitle>HSLA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff0080.png</icon></item><item uid="tylereich.colors hsl to name" arg="name|{"r":1,"g":1,"b":0,"a":"0.5"}" valid="yes" autocomplete=""><title>yellow</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff0080.png</icon></item><item uid="tylereich.colors hsl to rgb" arg="rgb|{"r":1,"g":1,"b":0,"a":"0.5"}" valid="yes" autocomplete=""><title>rgba(255, 255, 0, 0.5)</title><subtitle>RGBA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff0080.png</icon></item><item uid="tylereich.colors hsl to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":1,"b":0,"a":"0.5"}" valid="yes" autocomplete=""><title>rgba(100%, 100%, 0%, 0.5)</title><subtitle>RGBA percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ffff0080.png</icon></item></items>

 

----------

RGB

 

 

Notice: Undefined offset: 3 in /Users/kirklove/Dropbox/Alfred Sync Folder/Alfred.alfredpreferences/workflows/user.workflow.5C53E129-54B2-4086-A9C6-8E4990ACF8E6/colors.php on line 41

<?xml version="1.0"?>

<items><item uid="tylereich.colors rgb to hex" arg="hex|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>#ff0000</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors rgb to hsl" arg="hsl|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>hsl(0, 100%, 50%)</title><subtitle>HSL format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors rgb to name" arg="name|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>red</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors rgb to rgb" arg="rgb|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(255, 0, 0)</title><subtitle>RGB format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors rgb to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(100%, 0%, 0%)</title><subtitle>RGB percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item></items>

 

----------

RGBA

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors rgb to hex" arg="hex|{"r":1,"g":0,"b":0,"a":0.5}" valid="yes" autocomplete=""><title>#ff000080</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors rgb to hsl" arg="hsl|{"r":1,"g":0,"b":0,"a":0.5}" valid="yes" autocomplete=""><title>hsl(0, 100%, 50%, 0.5)</title><subtitle>HSLA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors rgb to name" arg="name|{"r":1,"g":0,"b":0,"a":0.5}" valid="yes" autocomplete=""><title>red</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors rgb to rgb" arg="rgb|{"r":1,"g":0,"b":0,"a":0.5}" valid="yes" autocomplete=""><title>rgba(255, 0, 0, 0.5)</title><subtitle>RGBA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors rgb to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":0,"b":0,"a":0.5}" valid="yes" autocomplete=""><title>rgba(100%, 0%, 0%, 0.5)</title><subtitle>RGBA percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item></items>

 

----------

Hexadecimal

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors hex to hex" arg="hex|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>#ff0000</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors hex to hsl" arg="hsl|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>hsl(0, 100%, 50%)</title><subtitle>HSL format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors hex to name" arg="name|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>red</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors hex to rgb" arg="rgb|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(255, 0, 0)</title><subtitle>RGB format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item><item uid="tylereich.colors hex to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":0,"b":0,"a":1}" valid="yes" autocomplete=""><title>rgb(100%, 0%, 0%)</title><subtitle>RGB percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff0000ff.png</icon></item></items>

 

----------

Hexadecimal Alpha

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors hex to hex" arg="hex|{"r":1,"g":0,"b":0,"a":0.50196078431373}" valid="yes" autocomplete=""><title>#ff000080</title><subtitle>Hexadecimal format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors hex to hsl" arg="hsl|{"r":1,"g":0,"b":0,"a":0.50196078431373}" valid="yes" autocomplete=""><title>hsl(0, 100%, 50%, 0.502)</title><subtitle>HSLA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors hex to name" arg="name|{"r":1,"g":0,"b":0,"a":0.50196078431373}" valid="yes" autocomplete=""><title>red</title><subtitle>CSS3 named color</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors hex to rgb" arg="rgb|{"r":1,"g":0,"b":0,"a":0.50196078431373}" valid="yes" autocomplete=""><title>rgba(255, 0, 0, 0.502)</title><subtitle>RGBA format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item><item uid="tylereich.colors hex to rgb_pcnt" arg="rgb_pcnt|{"r":1,"g":0,"b":0,"a":0.50196078431373}" valid="yes" autocomplete=""><title>rgba(100%, 0%, 0%, 0.502)</title><subtitle>RGBA percent format</subtitle><icon>/Users/kirklove/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/tylereich.colors.troubleshooter/ff000080.png</icon></item></items>

 

----------

Copy With Alpha

 

 

----------

Color Picker

 

 

----------

Reveal in Color Picker

 

 

----------

Clear Cache

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors picker" arg="pick|clear" valid="yes" autocomplete=""><title>Color Picker</title><subtitle>Action this item to reveal the OS X color picker</subtitle><icon>icon.png</icon></item></items>

Posted (edited)

Great, here is the output:

 

[…]

 

Clear Cache

 

<?xml version="1.0"?>

<items><item uid="tylereich.colors picker" arg="pick|clear" valid="yes" autocomplete=""><title>Color Picker</title><subtitle>Action this item to reveal the OS X color picker</subtitle><icon>icon.png</icon></item></items>

 

Thanks! Based on that output, I think I found the problem. Could you download this workflow and see what it does?

 

Cheers :)

Edited by Tyler Eich
Posted

Thanks again for all your help and the wonderful workflow. Much appreciated. 

 

You're very welcome! Thank you for sending me the bug report; without it, I would never have been able to fix this issue :)

 

 

Cheers :)

  • 5 months later...
  • 6 months later...
Posted (edited)

Weird, the 2.00 version from Packal doesn seem to work on OS X 10.7.5 ... I checked the workflow folder and the "Colors.app" inside requires OS X 10.8 or later., so it is blocked. Is that the problem ? Version 1.41 works fine for me though.

 

Edit : I've tested the "colors" executable, run in Terminal

sudo dtruss ./colors '#8a2be2'

and gotten the following error

failed to execute ./colors: Could not create symbolicator for task

This seems to be this bug that prevent the 2.00 version of the worflow from working on my machine. Can anyone help me on this ?

 

Meanwhile, I also replaced the "Colors.app" by the one I found on http://mattpatenaude.com/, if that might help.

Edited by ChrisDeveloper
  • 2 months later...
Posted

hsl(0, 0, 0) returns hsl(0, 0%, nan%) when it should return hsl(0, 0%, 0%).

 

 

Actually, hsl(0, 0, .0000000000000000000000000000000000000000001) get the proper thing, but add just one more zero and you get the Nan! 

 

Just so you know, I'm investigating this issue. For some ungodly reason, Colors isn't compiling at all with Xcode 6, so I'm having a rather difficult time debugging the code. I'll try to fix this (and a few other lingering bugs/annoyances) before too long!

  • 3 weeks later...
Posted

Hi! Will there be an update for Yosemite? The workflow stopped working for me after I updated.

 

Thanks!

 

What features are you having issues with? It still works on my end…

 

Running Alfred 2 v2.5.1 (306) on Mac OS X 10.10 (14A389)

Posted

What features are you having issues with? It still works on my end…

 

Running Alfred 2 v2.5.1 (306) on Mac OS X 10.10 (14A389)

 

It seems the issue was related to Alfred. After I switched to pre-release updates and updated from Alfred 2 v2.5 (299) to the latest v2.5.1 (308), the workflow started working again.

 

With the old Alfred version, the result stayed like this even after I typed a hexadecimal for the color:

Screenshot%202014-10-21%2015.05.24.png

Posted

Color works fine for me on Yosemite with Alfred 2.5 (299). But glad it works for you now. I generally like to stick with a stable release rather than a beta version if possible.

Posted

I get this error on "Colors" v1.41 running Yosemite with alfred v2.5.1.

[ERROR: alfred.workflow.input.scriptfilter] Code 255: Fatal error: Call to undefined function imagecreatefrompng() in /Users/lajlev/Dropbox/Privat/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5BD4F2BF-D506-464D-B683-03A0EBCC93C9/colors.php on line 123
[ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row 1, Col 1: 'Document is empty' in XML:
Fatal error: Call to undefined function imagecreatefrompng() in /Users/lajlev/Dropbox/Privat/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5BD4F2BF-D506-464D-B683-03A0EBCC93C9/colors.php on line 123
Posted

 

I get this error on "Colors" v1.41 running Yosemite with alfred v2.5.1.

[ERROR: alfred.workflow.input.scriptfilter] Code 255: Fatal error: Call to undefined function imagecreatefrompng() in /Users/lajlev/Dropbox/Privat/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5BD4F2BF-D506-464D-B683-03A0EBCC93C9/colors.php on line 123
[ERROR: alfred.workflow.input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 4.)'. Row 1, Col 1: 'Document is empty' in XML:
Fatal error: Call to undefined function imagecreatefrompng() in /Users/lajlev/Dropbox/Privat/Alfred/Alfred.alfredpreferences/workflows/user.workflow.5BD4F2BF-D506-464D-B683-03A0EBCC93C9/colors.php on line 123

 

Sorry, but v1.41 is not under active development, so any existing bugs will remain unfixed. If you'd like to update to the latest version, please download and reinstall the workflow from Packal :)

 

The workflow is working well for me on Yosemite, except the color picker doesn't seem to copy the eyedropper selected colour to the clipboard (or copy anything to the clipboard)

 

Thanks for pointing this out! It seems that OS X is taking focus away from the color picker after sampling the screen color. I've programmed the color picker to terminate when focus is lost, which causes this behavior. I'll see what I can do :)

  • 1 month later...
Posted

Hi Tyler Eich !

 

Thanks for your great Colors.

I would like to submit a feature request : Add Swift support for colors :-)

 

Glad you like it :)

 

I plan to add Swift support at some point; good to hear someone's interested it having it ;)

  • 5 weeks later...
Posted

i love it .. but I'm not sure how to bring up the color picker other than launching the color utility. or is the newer version than the one on packal?

You can't get the color panel to open? Packal does host the latest version…do you have any logs in Console.app related to "Colors.app"?

Posted

is the color picker just the colors.app app? that comes up.. i think I was conflating color picker with eye dropper..

Ah, there is a known issue with the eye dropper. You can see it on Github.

  • 9 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...