Date: prev next · Thread: first prev next last
2016 Archives by date, by thread · List index


On Tue, Sep 27, 2016 at 10:24 PM, Francisco Adrián Sánchez
<> wrote:
Dear design team,

My name is Francisco Sánchez, I'm a chemical engineer who loves doing his
work with LibreOffice (even though I'm not always allowed to). Although I'm
not listed in the design team nor mailing list, I've already contributed
some times with a few opinions and even I've presented some Impress
templates for the 5.0 conquest.

I've used OOs since 2009, and one thing that I had always missed from MS
Office was the ability to generate a color palette from some theme colors.

Since I'm a chemical engineer that knows Fortran (yes, Fortran) I decided
to code an app that were able to read some colors in RGB coordinates
generating then a LibreOffice color palette. Since these files are just
text files, I though they should be easy to produce using the only language
I know... Fortran.

That said, first I analyzed the gradients that MS Office 2007 produces, and
correlated the resulting alteration of each coordinate for each gradient.
For example, if one base color has a red coordinate of 50, the "clear 90%"
shadows will have a red value which is a function of 50.
Pardon me if I don't know if there's an easier way to do this, it's just
what I could do it.

Astonishingly, there is a correlation (a polynomial one). Based on the
coefficients I got, I coded the following app in Fortran. My app works
fairly ok, producing pretty similar results to the one that can be found in
MS Office.

I don't want to type a will here, but if you are interested on it I can
email you a link to download the code and some instructions to compile. I'm
not leaving any link here because I fear that the antispam filter will
catch this email. Thus, I've uploaded the code inside an ODT file into the
Document Foundation Wiki. Thus, if you are interested please look for the


There's an screenshot there also.

Last, I'd like to make it clear that I'm not intending to say that you
should include this code in LibreOffice, nor that LibreOffice should
generate the same palettes than MSOffice does.

However, I found my app quite useful for my proposes. Also, I know that
some of you are already dealing with document themes. So, I think that the
idea behind it could be useful for you also.

That said, I wish you will have a nice weekend.

Best regards,


It would be easier to use HSL colorspace instead of RGB. RGB is ideal
for monitors to produce a picture but not that good if you want to do
color manipulation. If you convert a RGB color to HSL colorspace you
have Hue - a 360 degree color value, Saturation of that color and
Lightness - how dark or light it is represented. This color
representation makes more sense and opens new possibilities. To get
the complementary color you just rotate the hue for 180°, adjacent
colors +-30°, desaturate a color, just lower the saturation...

So to make a set of colors you can just select some fixed saturation
and lightness values and then "rotate" the hue "wheel" and you get
your first set, then repeat.

What MS does with theme colors is tinting and shading, which is also
performed in HSL colorspace. Tinting means mixing the selected color
with white and shading is mixing with black (the value is in percent).
This is how they generate their palette, what I'm not sure exactly is
how they choose the mixing percentages.

You probably reinvented some transform color transform I guess.. but
it is an interesting approach too.

Regards, Tomaž

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.