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

how to change the color of the textframe content ?

Participant ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Hey all,

 

small question, I've searched for a way to change only the color of the text in the frame, and all the ways was to fill the frame or the border.

 

This's my code, how can i change only the color of the content! 

	var rect = doc.pages[0].textFrames.add({
			geometricBounds: [41, 53, 46, 64]
		});
		rect.contents = "HEYYY"

 

i'm using JS.

thanks all.

 

TOPICS
Activation billing and install , Bug , EPUB , Feature request , How to , Import and export , InCopy workflow , Performance , Print , Publish online , Scripting , SDK , Sync and storage , Type

Views

1.7K

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 2 Correct answers

Community Expert , Aug 26, 2020 Aug 26, 2020

Try the following, change the name of the swatch as needed

rect.texts[0].fillColor = app.documents[0].swatches.itemByName("C=75 M=5 Y=100 K=0")

-Manan

 

Votes

Translate

Translate
Community Expert , Aug 26, 2020 Aug 26, 2020

Use the swatch named [Paper] it preexists. If it does not work with [] the use the name without it

-Manan

Votes

Translate

Translate
Community Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Try the following, change the name of the swatch as needed

rect.texts[0].fillColor = app.documents[0].swatches.itemByName("C=75 M=5 Y=100 K=0")

-Manan

 

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
Participant ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Hey Manan, I've tried it, it works. But i want the color to be white.

so, i tried to do this but it informs me that it's invalid value for the set property 'fillcolor'.

rectBefore.texts[0].fillColor = app.documents[0].swatches.itemByName("C=0 M=0 Y=0 K=0")

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 Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Another option would be designing a paragraph style or character style with the proper colour that you need to use and apply that to the content of your textframe. The code snippet I gave will apply the colour but would cause style overrides, if you want to keep the overrides away you can try using styles

-Manan

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 Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Did you create the colour with that name before trying to use it? I don't see any issue with the code you have and it works fine for me

-Manan

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
Participant ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

What do you mean about creating color?

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 Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

The swatch that you are trying to apply, i.e., the one with the name "C=0 M=0 Y=0 K=0" does it exist in the document? Can you see it in the swatches panel? What I mean is if you don't have the color created, then you can't use it. For more details on how to create a swatch see the following

https://helpx.adobe.com/in/indesign/using/swatches.html#create_color_swatches

-Manan

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
Participant ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

I undetstand that sure!! But i dont understand why the color white not exist! 

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 ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

White is not a color - it is the complete absence of color.

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 Expert ,
Sep 17, 2022 Sep 17, 2022

Copy link to clipboard

Copied

LATEST

It depends on how you approach it. 

For print, white is the absence of INK (subtractive color). Technically, the paper tint would show through, which is why InDesign calls it "Paper".

 

From a physics viewpoint, white is the combination of all colors (additive color). 

 

David Creamer: Community Expert (ACI and ACE 1995-2023)

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 Expert ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Use the swatch named [Paper] it preexists. If it does not work with [] the use the name without it

-Manan

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
Participant ,
Aug 26, 2020 Aug 26, 2020

Copy link to clipboard

Copied

Thanks so much it works!

 

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