Skip to main content
November 26, 2013
Question

Changing opacity of text

  • November 26, 2013
  • 2 replies
  • 1142 views

I'm trying to change/access the opacity of a text object (Illustrator CC).

In the documents, I found that it's represented by a text frame object, but it doesn't have opacity property. Text range and character attributes don't have it either, so I'm wondering: is there any way of accessing/altering the opacity of a text object using Javascript?

This topic has been closed for replies.

2 replies

CarlosCanto
Community Expert
Community Expert
November 26, 2013

it is not documented but text frames do have opacity property in Javascript, as stated above in vb as well.

yourTextFrame.opacity = 50; // 50% opacity

Inspiring
December 5, 2013

Hi Carlos, as inquired in this recent thread:

http://forums.adobe.com/thread/1350419?tstart=0

Does illustrator have the ability to change opacity at the per character level like in the UI via scripting?

CarlosCanto
Community Expert
Community Expert
December 5, 2013

I couldn't do it directly, the workaround is

- create a new character style manually with the opacity needed

- apply such character style to any textRange via scripting

ThinkingThings
Inspiring
November 26, 2013

This works in VB.NET if this is of any help...

Dim aDoc As AI.Document = app.ActiveDocument

  For Each pi In aDoc.PageItems

   Select Case TypeName(pi)

    Case "TextFrame"

     Dim tf As AI.TextFrame = pi

     tf.Opacity = 20  '20% Opacity

   End Select

  Next