Specifying color in RTF

Posted on 2007-10-08
Last Modified: 2013-12-25
Can someone confirm or correct my understanding of specifying colors in RTF.

The RTF document declares a color table, such as:


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?
Question by:paddycobbett
    LVL 60

    Accepted Solution

    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
    and now use \cf6
    I have done that before in several occasions, and allthough it requires some counting, it works well


    LVL 1

    Author Comment

    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 =)
    LVL 60

    Expert Comment

    by:Geert Bormans

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
    Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now