Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

Specifying color in RTF

Can someone confirm or correct my understanding of specifying colors in RTF.

The RTF document declares a color table, such as:

{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue0;\red255\green0\blue0;\red255\green255\blue255}

To define text with a certain color requires referencing a certain index in the color table, such as:

{\f1\cb1\cf2 This is colored text. The background is color 1 and the foreground is color 2.}

So am i right in thinking that all colors must be defined in the color table, and then subsequently referenced? Is there no way to define the color adjacent to the text? .. or somehow overwrite the color table?
0
paddycobbett
Asked:
paddycobbett
  • 2
1 Solution
 
Geert BormansCommented:
I am afraid that there is no other way than dealing with a colortable
You can easily add colors to the color table, and use the incremental number
In your example you have 5 colors
You could add a sixth one
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue0;\red255\green0\blue0;\red255\green255\blue255;\red212\green56\blue56;}
and now use \cf6
I have done that before in several occasions, and allthough it requires some counting, it works well

cheers

Geert
0
 
paddycobbettAuthor Commented:
Thanks, i've now implemented a solution which relys on the color table.. but thanks for reassuring me that it was the only way to do it =)
0
 
Geert BormansCommented:
welcome
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now