Jump to content

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


Recommended Posts

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>

Link to comment

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
Link to comment
  • 5 months later...
  • 6 months later...

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
Link to comment
  • 2 months later...

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!

Link to comment
  • 3 weeks later...

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

Link to comment

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
Link to comment

 

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 :)

Link to comment
  • 1 month later...
  • 5 weeks later...

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"?

Link to comment

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...