In programming languages the editors use code highlighting, namely they use different colors for different keywords, for example green color for WHILE, blue color for BEGIN, red color for IF THEN ELSE etc ....

I have a set of about 150 text files with code in C with the default black color and I want to open them in Illustrator and colorize them according to the above rules ...

Is there an efficient way to do this instead of selecting all of them one by one and change its color?

  • Can you use InDesign? You can do this with Data Merge. Not sure if this also works for Illustrators Data Merge.
    – AndrewH
    Aug 18, 2021 at 20:34
  • 2
    I would totally use InDesign for this. With GREP Styles you can use regular expressions to apply different Character Styles automatically. Would a solution for InDesign be of any interest?
    – Wolff
    Aug 18, 2021 at 21:29
  • 2
    Export pdf (or if possible rtf) from your editor then open that.
    – joojaa
    Aug 19, 2021 at 5:01
  • Similar question (Indesign): graphicdesign.stackexchange.com/questions/143482/… - This is about VSC, but the same thing more or less works in all or most editors and Indesign. In either application, Illustration or Indesign, PDF isn't a terrible option. Like I shortly mentioned in the answer there, some editors have plugins for exporting to RTF or PDF. Even if the best you can do is RTF and you want to keep using Illustrator, you should be able to convert RTF to PDF with some other apps/tools.
    – Joonas
    Aug 19, 2021 at 6:54
  • In this case though, you might be able to use something like carbon.now.sh and skip the editor entirely. It can save to SVG, but by my experience the SVG's these tools produce are ...not very reliable. Any attempt to open or place these files in AI, Inkscape, INDD or even Photoshop gives you plain text at best. That said, the 4x PNG would likely be big enough even for print in many cases. Never used this, but you could potentially process the text files in cli using: github.com/mixn/carbon-now-cli
    – Joonas
    Aug 19, 2021 at 7:01

3 Answers 3


If you're ok with a solution outside of graphic design application, you could simply let Notepad++ or similar text editors handle syntax highlighting of your code and change colors and fonts in the editor's options to your needs.

You just have to make sure to export the formatting and not just plain text. In Notepad++ you can either use "Copy RTF to clipboard" or "Copy HTML to clipboard" and then paste it in Illustrator. Not all text editors support this, though I'm sure you can find one with this feature for most platforms.

There are also online syntax highlighting tools which let you export to HTML, for example: https://tohtml.com/. These online tools usually have less customization options, but you can edit the resulting HTML and e.g. change colors.

  • Or you can print to PDF then open the PDF in Illustrator
    – slebetman
    Aug 20, 2021 at 8:04

In Illustrator I do not know of an option to do this automatically.

In Indesign you could kind of automate it with GREP styles:

enter image description here

There may also be plugins for indesign to do this. For example this very simple one on github id-simple-syntax-highlighter.

Or probably the best way is to use a online tool to highlight the syntax, copy it and paste it into Indesign. By default it will remove the style, but in "Preferences / Clipboard Handling" you can choose to preserve the styling of text:

If you need to use Illustrator you may want to research if there is an option to paste styled text.

enter image description here


If I understanding well your question, you will open a text file and change color attributtes for the text with conditions. In this case I'll try to make some search and replace applying the colors rules, but in this case you need to know what type it's the file of text. If is a pure text, probably you couldn't get the result you want and when you import inside the Illustrator, problably you will lose the color format. So, you need to import inside the InDesign and export as PDF, to open in Illustrator with the text format.

  • Yes, this is the case. I use the gedit editor in Linux, an application that uses different colors for the various keywords, but when i copy text and paste in another application, since it is a pure text the color information is lost. Aug 18, 2021 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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