Highlighted

how to change the color of the textframe content ?

Participant ,
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.

 

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

-Manan

Topics

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

Views

86

Likes

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

how to change the color of the textframe content ?

Participant ,
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.

 

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

-Manan

Topics

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

Views

87

Likes

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
Aug 26, 2020 0
Adobe Community Professional ,
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

 

Likes

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
Reply
Loading...
Aug 26, 2020 0
Participant ,
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")

Likes

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
Reply
Loading...
Aug 26, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 26, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 26, 2020 0
Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

What do you mean about creating color?

Likes

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
Reply
Loading...
Aug 26, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 26, 2020 0
Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Aug 26, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 26, 2020 0
Participant ,
Aug 26, 2020

Copy link to clipboard

Copied

Thanks so much it works!

 

Likes

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
Reply
Loading...
Aug 26, 2020 0