5

I have a list of colors as RRR GGG BBB in a text file and I need to use only those colors to create my images. I'd like to be able to load those colors to Photoshop's color palette (swatch). Is there a way to automate swatch creation process from within Photoshop or some other way to create swatch file from a list of colors as a text file?

(P.S. there should be tags such as Palette and Swatch)

Upd: I have lots of colors in the list and my list is not the only one, users are supposed to have easy way to convert the list into Photoshop compatible swatch file so we can all start drawing right away.

2

4 Answers 4

5

I'd create a small web page and then take a screen grab. You'll end up with a bitmap image you can place on a layer. From there you can sample the colours and use them in your design.

If your list looks something like this:

0 0 0
0 0 255
0 255 0
255 0 0

Some clever find/replacing should get you what's needed to create a web page. Depending on the exact characters in the document, you should hopefully be able to get the document into this format. Finding spaces and replacing with ", " should give you this:

0, 0, 0
0, 0, 255
0, 255, 0
255, 0, 0

You could then find the return character, and replace with something like this:

);">&nbsp;</div> *return character*
<div style="width:100px;height:100px;float:left;background:rgb(

So you end up with:

0, 0, 0);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(0, 0, 255);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(0, 255, 0);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(255, 0, 0)

Which means you just need to add a little bit of HTML to the start and end of the document to have a webpage you can display and screen grab.

<!DOCTYPE html>
<html lang="en-us">
<body>
<div style="width:100px;height:100px;float:left;background:rgb(0, 0, 0);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(0, 0, 255);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(0, 255, 0);">&nbsp;</div>
<div style="width:100px;height:100px;float:left;background:rgb(255, 0, 0);">&nbsp;</div>
</body>
</html>

Make sure the browser you use displays the colours in a way that matches your raw colour values though. You can test this by checking a few of the colours — see if they match the values you initially entered.

You could even save the find and replace strings and process future files in the same way.

If you really need the result to be a Photoshop swatch file, you might need to enlist a friendly developer to create a small script to build the files you're after.


Another option is scripting Photoshop to automate adding the swatches directly, rather than building a swatch file. The PS-Scripts forum might be a good place to look for help.

http://www.ps-scripts.com/bb/viewtopic.php?t=842

3
  • >If you really need the result to be a Photoshop swatch file, you might need to enlist a friendly developer to create a small script to build the files you're after. — That's what I'm asking for, is there an app for that or at least some tutorial on making your own swatch files? Parsing RGB into a web page, using a browser, making a screenshot, and I didn't find in your answer how to make a swatch file out of that. Seems like a lot of unnecessary steps to make a swatch file out of RGB values! Oct 2, 2012 at 10:20
  • The idea is to have a bitmap swatch. You can take samples straight from the bitmap itself, without needing a swatch file. Oct 2, 2012 at 11:37
  • Just added another option above... you could create a script to add the swatches directly to Photoshop. Oct 2, 2012 at 11:52
2

ASE is Adobe Swatch Exchange Format. Unfortunately, it is a binary format, but fortunately, people have made source code available for ASE encoding scripts. See for instance ( http://blog.soulwire.co.uk/code/actionscript-3/as3-ase-adobe-swatch-exchange-encoder ).

Adobe may support ACBL format (XML) or ACF format (text), but they appear to be legacy formats and do not show up in the "load swatches" file types options.

This doesn't always mean they aren't supported, but you will need to get your file dialog to ignore the file-type filter:

windows, type *.* in the file name box and hit enter

4
0

You may not have the Color panel open by default, so click Window -> Color (or F6) the color panel will open and you should see 3 RGB sliders, or 4 CYMK sliders depending on your colour mode.

Next to the sliders (left) are 2 squares, click on one of them and you get the "Color Picker" window.

Now simply enter the RGB numbers, and click "Add to Swatches" (it will then ask you for a name, then click save.

Done :-)

1
  • 2
    I have 359 different colors in text format, I would really like an automation of some sort for that. Oct 1, 2012 at 15:20
0

EDIT: very similar but even simpler solution in comments: How can I easily convert a plaintext list of HEX values to an adobe ACO/ASE color palette file?


If the colours are in a format that are valid SVG-colors (let's say: HTML/CSS colors) and you do not need the names of the colors to be stored in the swatches and you have access to Illustrator, then:

  1. Create a SVG file with 1 rectangle per color. (*)
  2. Open the SVG file in Illustrator
  3. Select all artwork, open Swatches panel, from 'hamburger menu' choose create new Color Group
  4. From same menu, choose Save swatches as ASE

At 1, (*):

Use an advanced text-editor like TextMate that allows for multi-caret selection. Paste the list of colors into the editor and make sure there is a cursor (caret) in front off every color. Now, you can wrap each color in a SVG-rect tag, as such:

<rect width='10' height='10' fill='#F5D6B2' />

You can do this for all colours simultaneously! Add an <svg> tag in the front and a </svg> closing tag at the end, save as "MyFirstColorList.svg" or whatever and open in Illustrator.

Note also that:

  1. This might also be possible in Photoshop straight away, but I do not know that.
  2. Turning a list of colors into a list of rectangles might also be possible with command-line magic or smart search-and-replacing in MSWord or any other text-editor or word processor.

(This is an (almost) verbatim copy of my answer at https://community.adobe.com/t5/indesign-discussions/how-to-write-adobe-swatch-exchange-ase-file/m-p/12720707#M463886)

3
  • 1
    You can do this with a dead simple CSS file.. no need for SVG or rectangles or anything really... just a list of values and a closing CSS bracket. graphicdesign.stackexchange.com/questions/155558/…
    – Scott
    Feb 1, 2022 at 13:52
  • Looks good! I did not find your answer when I looked into this problem. I edited my answer to refer to yours instead. Duplicate questions?
    – Ideogram
    Feb 1, 2022 at 14:13
  • Hi! Yes. Duplicate questions but 10 years apart :) I suspect Photoshop just got easier in this respect over the past decade.
    – Scott
    Feb 1, 2022 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.