Open Source Software Technical Articles

Want the Best of the Wazi Blogs Delivered Directly to your Inbox?

Subscribe to Wazi by Email

Your email:

Connect with Us!

Current Articles | RSS Feed RSS Feed

Toward a more colorful LibreOffice


Recently, I was working on an Impress presentation, and I needed more colors than LibreOffice provides with its standard color picker. Specifically, I needed several light colors, but the standard color list includes only a few light blue possibilities. I could have defined my own colors manually using the Color Picker, but "mixing" colors by specifying RGB or CMYK numbers is a cumbersome, hit-or-miss process. LibreOffice also lets users load predefined color libraries, but none of the ones I found suited me. Instead, by working with web-standard colors plus a little bit of awk scripting, I managed to create my own color list, providing well-organized colors, grouped in families, with as many color variations as I wanted.

The Impress and Draw components let you load a new color list and add colors to it, which is an option if you just need one or two new colors and know how to define them. (An aside: Any color changes you make in Impress or Draw become available for all LibreOffice components.) Open Impress or Draw, go to Format -> Area -> Colors, and you'll see the table of all available colors, with their RGB and CMYK equivalents, along with commands for editing the list:

The standard LibreOffice color list

Modifying the standard color table is straightforward. To add a new color, enter a name for it, select its R, G, and B values, and click the Add button. Your new color is added at the bottom of the table. To modify an existing color, click on it, change its R, G, and B values, and click on Modify. You can select a color several different ways by clicking on the Edit button (see figure below). Finally, to delete a color from the color table, select it and click on Delete.

LibreOffice lets you handpick a color in several different ways

LibreOffice or OpenOffice?
LibreOffice was forked off OpenOffice in 2010, but the color lists you develop apply equally well to both, though you might need to make some adjustments to file names and locations.

If you were skilled enough, you could create a whole set of colors in the standard table by using these tools. LibreOffice saves its standard color table in the file standard.soc, whose location varies from distribution to distribution; openSUSE saves it in $HOME/.config/libreoffice/4-suse/user/config, but the standard place is $HOME/.libreoffice/4/user/config. You can learn the location by clicking on the Load Color List icon in the Format -> Colors dialog and taking note of the directory it shows.

(By the way, different distributions not only change the location of the file, but also its contents. For instance, Ubuntu includes three special colors – Ubuntu Orange, Ubuntu Yellow, and Ubuntu Red – and Red Hat includes Red Hat 1 through Red Hat 5.)

LibreOffice also provides alternate color lists, with different sets of colors. Click on the Load Color List icon in the Format -> Colors dialog to see a list of available *.soc files. (I assume, but couldn't verify, that "soc" stands for "set of colors.")

I tried out many tables, but despite getting more options than with the standard table, I still wasn't satisfied. I finally decided to produce my own color list, with enough variations to suit me, grouped in color families, so finding the right shade would be easier. I'll walk you through the process, but first you need to know a little about how computers represent colors.

Color models: RGB and CMYK

Since computers are digital machines, colors must be represented as numbers, and a color model is a way of doing just that. RGB is an additive model, based on red, green, and blue lights, which added together in varying intensities produce colors. Colors in the RGB model are specified by three numbers, from 0 (minimum) to 255 (maximum). Zero intensity for all lights produces no color at all (black) while maximum intensity for all colors gives white. If intensities are not all the same, you get variously colored hues. Higher component values mean lighter colors (all the way from black to white) so to get a lighter version of a RGB color, you have to increase its R, G, and B values, and for a darker version, you decrease those values.

Computers use RGB for screens, but for printed output CMYK is standard. CMYK is a subtractive color model based on four ink colors: cyan, magenta, yellow, and key (black). Using no inks at all is plain white. Each ink absorbs certain frequencies of light, so mixing inks in specific proportions can produce other colors. Mixing cyan, magenta, and yellow inks in maximum proportions (100%) should produce black, but actually gets you a dark muddy brown, and that's why CMYK uses a fourth ink, black. CMYK colors are given by four percentages, so a green color could be produced by something around (15%, 0%, 35%, 35%) meaning 15% intensity of cyan, no magenta at all, and 35% intensities of both yellow and black.

To produce darker and lighter variations, CMYK works the opposite way from RGB: Higher values (more ink) mean darker colors, and to get a lighter variation of a color (less ink) you have to lower its C, M, Y, and K values.

By default, LibreOffice uses RGB to specify screen colors, and we'll use it when we create our color table. In binary, each color is represented by a 24-bit number, so there are 2^24 possible variations, or 16,777,216 colors in all.

What's a .soc like?

So much for the way colors are represented. The next step is to determine the format for .soc files. While downloading the full source code for the LibreOffice suite and searching around for the correct description was one way to figure that out, I felt that the file format shouldn't be too hard to deduce, and when I looked at a few .soc files on my own, that proved to be the case.

Color lists are XML files that contain a <draw:color> element for each defined color, given by its RGB value in hexadecimal:

<?xml version="1.0" encoding="UTF-8"?>
<ooo:color-table xmlns:office=

    draw:name="Black" draw:color="#000000"/>
    draw:name="White" draw:color="#ffffff"/>
    draw:name="Blue" draw:color="#000080"/>
    draw:name="Green" draw:color="#008000"/>

...many lines snipped out...

    draw:name="Chart 10" draw:color="#ff950e"/>
    draw:name="Chart 11" draw:color="#c5000b"/>
    draw:name="Chart 12" draw:color="#0084d1"/>

Since XML files are text files, producing a table of such elements should be easy for a script – you just need to decide how to automatically generate variations for a table of colors and then write some awk code to do the actual work.

So how are we to produce color variations? Given a base color, we can produce darker or lighter variations of it by modifying its R, G, and B values, but not haphazardly. If we make a large variation in the R component it should be accompanied by proportionally large variations in the G and B components, or we'll end up with a totally different hue.

Of course, in order to accomplish this, we need a list of starting colors, which we can modify to get variations, and then do some calculations to actually produce the .soc file. To see how, read part two of this series.

This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.


Posted @ Monday, May 13, 2013 6:00 PM by John
Good post and useful information. 
Thanks for sharing
Posted @ Wednesday, May 15, 2013 2:31 AM by RoseHosting
Glad I could be of help -- please do remember to check the second part of the article, at
Posted @ Friday, May 17, 2013 3:58 PM by Federico Kereki
Think about how rich Aboriginal artists bag cost. A Balenciaga bag is made according to the gucci replica transaction on the crowded car. Most consumers ignorant the desired amount of account, in the end, the abnormal return my wallet with alarming speed. The two is effective. Louis Vuitton, for example, can separate the consequences of 100 professional equipment in a confident line. The chanel replica equipment will be assigned to the audience a small number of important once. If a packet's admirers is lucky, hit will impact the retail outlets, mostly alone in the upper cover and contain everything the city such as New York and Dubai. Competition is cruel, and the cat and the mouse the list goes on and curve from the local aperture confident hundreds. The louis vuitton replica last is practical. Well, the alligator clutch sounds backpack accurate, how do you usually go to use it? You can pay the maintenance, proper maid and storage? Is a kind of way, your wardrobe conditions keep wet, the moth? If people expect it will how bad the scratches, $2000 for a charity trip, feel the pinch. A sudden not parieto frontal base bear so smart. A copy of the replica shoes above will be acceptable to the appearance of a large number of bags for the natives have not buck the above signs, stamp or brand as raw. An acceptable copy acceptable appearance, rich butt "absolute, but there will be a rich analysis of aberration. Copy bags manufacturers don't run farther in law, is definitely a lasting alleys cleverly Cher action and a fine. Another one is the changes in the material. Back, the bolt will be cheaper. Gold accessories the agency rather than absolute gold, or honeycomb alternating accent instead of a solid. The dior replica ability to override the domestication is absolutely not adapt soft. Close, may not be as solid or solid.
Posted @ Sunday, September 28, 2014 10:02 PM by Heaity
Post Comment
Website (optional)

Allowed tags: <a> link, <b> bold, <i> italics