• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
9

Script to generate color information textboxes for selected paths

New Here ,
Oct 04, 2019 Oct 04, 2019

Copy link to clipboard

Copied

Hello Community!

 

I am looking for a way to generate textboxes on top of paths that contain fill color information:

- Hex (probably not possible?)

- CMYK values

- RGB values.

 

Ideally you would select paths on your artboard, run the script and text boxes would be generated as such:

Screen Shot 2019-10-04 at 4.57.22 PM.png

 This script comes close, but does it for swatches in the document. However, I need it for the fill color for paths already on the artboard:

http://fashionclassroom.com/blog/handy-illustrator-script-for-printing-out-color-chips

https://github.com/johnwun/js4ai/blob/master/renderSwatchLegend.jsx

Also here is some discussion that touches on the subject: https://webcache.googleusercontent.com/search?q=cache:fLUn9JnVfDkJ:https://forums.adobe.com/thread/6...

 

Any help would be greatly appreciated!

 

Best regards,

Martin

TOPICS
Scripting , Tools

Views

19.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 4 Correct answers

Advocate , Oct 05, 2019 Oct 05, 2019

Did you know that you can create a new color group from the selected paths?

Simply select your paths and push the "new color group" button at the swatch panel...

Then you can use the rederSwatchLegend.jsx from wundes

 

Maybe you have to modify it first...

Votes

Translate

Translate
Advocate , Feb 06, 2023 Feb 06, 2023

If you saved it and changeed it to .JSX it should work fine. Ive got a link to my version here, https://github.com/schroef/Illustrator-Scripts/blob/master/renderSwatchLegend_v145.jsx
again click raw and make sure you save it and try to replace the .txt to .jsx 

Screen Shot 2023-02-06 at 17.26.31.pngScreen Shot 2023-02-06 at 17.26.26.png

Votes

Translate

Translate
Advocate , Feb 07, 2023 Feb 07, 2023

Ah yeah, that is due to the separator. Perhaps I should add an extra Rule for that as an option. Let me see if I can add this. I'll post an update link later.

 

It's always better to save the file directly to jsx from the browser unless you know how to save the file in a proper format without issues.

Votes

Translate

Translate
Advocate , Mar 01, 2023 Mar 01, 2023

I got it working now as i think you asked for. Ive added an extra option, to join HEX values, this can keep other values split

Example of outputExample of outputAdded option join HEXAdded option join HEX

Here's a link to the RAW script on my gitHub.  Remember when saving from browser, remove .txt at the end

Votes

Translate

Translate
Adobe
LEGEND ,
Oct 05, 2019 Oct 05, 2019

Copy link to clipboard

Copied

Hex is EXACTLY the same thing as RGB; it's just a different way of writing the same thing.

For instance, hex FF means 255, hex 80 means 128.  So hex FF80FF means RGB 255, 128, 255.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Oct 05, 2019 Oct 05, 2019

Copy link to clipboard

Copied

Did you know that you can create a new color group from the selected paths?

Simply select your paths and push the "new color group" button at the swatch panel...

Then you can use the rederSwatchLegend.jsx from wundes

 

Maybe you have to modify it first...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2019 Oct 07, 2019

Copy link to clipboard

Copied

Thank you Tom Winkelmann, your reply lead me to a workable solution without diving too much into scripting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 30, 2022 Dec 30, 2022

Copy link to clipboard

Copied

I see you have HEX in the legend now as well. Ive added some extra features to this script, like HEX. That version did not have it yet back then. Ive also made an interface so you can choose what to show. Idea is to make it even more customizable in the feature. Wundes has updated to 4.4 with two of my adds, but not the one with the dialog and save settings

Example of Renderlegends with a dialogExample of Renderlegends with a dialog
Here's a preview

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 28, 2023 Jan 28, 2023

Copy link to clipboard

Copied

Hi @schroef ! 

Where can your script with the interface be downloaded from? Also, couldn't seem to edit the one from johnwun at https://github.com/johnwun/js4ai/blob/master/renderSwatchLegend.jsx  to work properly.

 

For the johnwun script I'm not sure where to download the jsx file directly (I can usually manage to find the download on github but not this time) so I've copied the text, saved as text edit on mac, changed the file to jsx and can get it to run in illustrator but it doesn't work. Attached the text file I converted to jsx here as well. Tried fiddling with the x/y values but it gives me this error. Tried selecting the shape with the colour, have them in the swatch panels or nothing selected and other variations. Also tried the solution above for generating the colour palette as a group and selecting the group, no luck. 

 

I'm clearly missing something about how to use this script even with the basic instructions on the github that say "// This script will generate a legend of rectangles for every swatch in the main swatches palette." and the ones in this thread. Attached screenshot of the error I get. Help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

You can directly save that Jax by clicking "vier raw". Then add .ksx

 

His script lacks one more update I added, he didn't want that. I have added code so it saves all settings.

 

I'll post a link later today when I'm at work.

 

Ps it should work when you select swatches in the swatch panel. That's one of the edits I've made.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 05, 2023 Feb 05, 2023

Copy link to clipboard

Copied

Hmm. Saved the raw file from here https://raw.githubusercontent.com/johnwun/js4ai/master/renderSwatchLegend.jsx

as text, changed to .jsx, it loaded fine in illustrators file > scripts to use but same issue. 

 

Tried running the script with colored rectangle selected, coloured rectangle + swatch selected, no rectangle selected and only swatch. Put swatch in it's own group and selected the swatch and/or the group. Still no luck! Tried deleting all swatches except reg black/no fill, having only one new swatch and no luck either. 

 

Think I'm missing something very basic in how to run the script, hope you can set me straight! 

"This script will generate a legend of rectangles for every swatch in the main swatches palette. You can configure spacing and value display by configuring the variables at the top of the script."

 

Awaiting your script and reply that will hopefully be the ultimate fix. Thanks again. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

I need to check something in the script. It returns weird errors about being able to add a group. Even the original shows that now. Let me fix that and then return to you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 05, 2023 Feb 05, 2023

Copy link to clipboard

Copied

Thank you! Awaiting your next reply. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 06, 2023 Feb 06, 2023

Copy link to clipboard

Copied

If you saved it and changeed it to .JSX it should work fine. Ive got a link to my version here, https://github.com/schroef/Illustrator-Scripts/blob/master/renderSwatchLegend_v145.jsx
again click raw and make sure you save it and try to replace the .txt to .jsx 

Screen Shot 2023-02-06 at 17.26.31.pngScreen Shot 2023-02-06 at 17.26.26.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 06, 2023 Feb 06, 2023

Copy link to clipboard

Copied

Amazing thank you, the interface you added are so essential! And it seems the fix for me was to stop converting .rtf to .jsx, had to turn my textedit on mac into a plain text from Format > Make Plain Text..... did not realize the syntax error that illustrator was yelling about was me saving as rich text. 

 

One question, is there a way to make the HEX render not have spaces? It comes out as "HEX  xx xy 23" instead of "HEX xxxy23" for instance. Guessing this is a quirk of the script and a tradeoff for having CMYK and other values render with spaces? Regardless, this script will save SO MUCH time. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 07, 2023 Feb 07, 2023

Copy link to clipboard

Copied

Ah yeah, that is due to the separator. Perhaps I should add an extra Rule for that as an option. Let me see if I can add this. I'll post an update link later.

 

It's always better to save the file directly to jsx from the browser unless you know how to save the file in a proper format without issues.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

I got it working now as i think you asked for. Ive added an extra option, to join HEX values, this can keep other values split

Example of outputExample of outputAdded option join HEXAdded option join HEX

Here's a link to the RAW script on my gitHub.  Remember when saving from browser, remove .txt at the end

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2023 May 26, 2023

Copy link to clipboard

Copied

I've been searching for something like this to easily copy and paste color values into brand guides, this is amazing and will help so much! 
Two questions:

  • It seems to collapse '00' in the hex codes to a single '0' is there a way to prevent that?
  • Is there a way to have the dialogue box open with default options pre-selected? For example, I'm only ever going to need CMYK, RGB, and HEX every time with the same separator.

 

THanks again for creating this, it's such a game-changer!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 31, 2023 May 31, 2023

Copy link to clipboard

Copied

Iol need to tix the hex code part. I noticed it sometime missed a leading 0. I got it working now in another scriot and will uodate this one asap.

 

@kew113091 

It does save a file but i Bel ve i set it up so it saves it next to the workout jg document. I could change it so it saves that next to the ecript.

 

You can always adjust it your self if your comfortable doing so

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2023 Jun 01, 2023

Copy link to clipboard

Copied

I was able to figure out how to modify default settings actually! No luck on that '00' issue though, that was a bit too advanced for me ha! Will look out for an update whenever you get the chance 🙂 thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 03, 2023 Jun 03, 2023

Copy link to clipboard

Copied

Well done! So you figured out in the lower end of the script file has the location for the json file to bestored. Nice work!

 

I had the plan to edit it this week, but as lofe goes. Something came in between. Perhaps today i can have another go at it.

 

Here's the updated version; link to raw code v1.4.8 

Now HEX code is fixed. PS the settings were already saved next to the script. Doesnt that work for you?

It remembers last used settings. Just tested it and still works as it should.  Each time you run it, it saves a JSON file with all settings. This was working in a couple versions back. Perhaps something did run well in the version you had. It does run properly today when i tested it

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 08, 2024 Jan 08, 2024

Copy link to clipboard

Copied

Hi, your link isn't working and this seems like a great script. Is it available anymore?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 08, 2024 Jan 08, 2024

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 12, 2024 Jan 12, 2024

Copy link to clipboard

Copied

Would you have any problem of my doing a TikTok video on your Version of the RenderSwatchLegend? I did one a couple months ago when I only knew of 1.4.4 but this looks far more advance. Please need this in their life.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 13, 2024 Jan 13, 2024

Copy link to clipboard

Copied

Do so if you like. Be sure to show them where to get it! Ps post the video here if you can. Link it in a comment if possible or add a link to the post. Like to see it

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2024 Jan 17, 2024

Copy link to clipboard

Copied

Thank you @schroef for all your hard work.
I just uploaded the video to my TikTok channel. Unfortunately I don't know what you TikTok user name is, or else I would have tagged you.

https://www.tiktok.com/@gibbous.does.branding/video/7325082573103762731

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jan 17, 2024 Jan 17, 2024

Copy link to clipboard

Copied

No worries! Nice videos by the way


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 17, 2024 Jan 17, 2024

Copy link to clipboard

Copied

Thank you. I'm happy it meets your approval 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines