Format multi-color text in Pages on Mac

I write materials with a programming code like this:


It has certain colors that I would like to keep in the material.

I paste code from my IDE and it needs to be formated before it becomes as shown.


When pasting, the colors are saved.


For every pasted code it needs to adjust:

  • font size
  • spacing between lines


If create the paragraph style or character style and apply it to the code segment, the code colors will change.

Is there a way to save the necessary formatting options as some preset so that it doesn't affect the color of the code after applying?


Mac mini

Posted on Feb 14, 2025 05:12 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 14, 2025 09:29 AM

When I open an Objective-C file in Xcode 16.2 on Sequoia v15.3.1, and copy and paste it into Pages v14.3, the syntax coloring is preserved. I then select that code in Pages and change its font to Adobe Source Code Pro with a slight increase in line height (e.g. 1.2) and font size increase to 13 pt. I deselect the text and add a new Source Code Pro named paragraph style.


I remove the pasted code and repaste it from Xcode. I select that code and apply the Source Code Pro paragraph style. It changes the code font and line height as expected and I can observe no color shift in the open document.


You will have multiple character styles owing to the nature of styled, syntax-aware content.


You will need to save your new code paragraph style in a Pages template for future document usage.


3 replies
Question marked as Top-ranking reply

Feb 14, 2025 09:29 AM in response to кирилл278

When I open an Objective-C file in Xcode 16.2 on Sequoia v15.3.1, and copy and paste it into Pages v14.3, the syntax coloring is preserved. I then select that code in Pages and change its font to Adobe Source Code Pro with a slight increase in line height (e.g. 1.2) and font size increase to 13 pt. I deselect the text and add a new Source Code Pro named paragraph style.


I remove the pasted code and repaste it from Xcode. I select that code and apply the Source Code Pro paragraph style. It changes the code font and line height as expected and I can observe no color shift in the open document.


You will have multiple character styles owing to the nature of styled, syntax-aware content.


You will need to save your new code paragraph style in a Pages template for future document usage.


Feb 15, 2025 02:56 AM in response to VikingOSX

Thanks, VikingOSX! I repeated the pasting code from Xcode. After applying saved Paragraph style there is no color shift, colors stay as pasted.


In my case I pasted a code from IntelliJ IDEA, in that case with the same process colors are shifted. So it is the influence of IDE.


Also I took a normal text. Set new line spacing and font. Deselect text, add new paragraph style.

Then paste some text again, add colors to it. Select this text, apply saved Paragraph style - font and spacing becomes new and colors does not change.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Format multi-color text in Pages on Mac

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.