You are here:Home»KB»Applications»How to extract a color from a text in Libre Office
Monday, 15 June 2015 09:00

How to extract a color from a text in Libre Office

Written by

There might be occasions where need to know the colour of a text used in a libre office document. I will show you here the different methods that i know of.

These will probably work on open office documents aswell.

Copy and Paste

  • In libre office highlight the text and copy it
  • open up your favourite WYSIWYG (i used JCE Editor in Ioomla)
  • paste

The text is now pasted in to the wysiwyg and the hex code is contain in a <span> tag around the text for you to use.

Extract and Unzip

Most people dont know that libre office files are zip compressed and that the actual language is an xml style similiar to html if not a derivative.

  • but if you use an unzip file to look at the zip'd contents of a .odt file, you'll find content.xml.
  • In there will be style definitions that include colours specified in hexadecimal.

For example, from a little test file that I made:

<style:style style:name="T4" style:family="text"><style:text-properties fo:color="#008000"/></style:style>
<text:span text:style-name="T4">green</text:span>

You can then use Tools > Options > LibreOffice > Colours to add any desired colour to your GUI.

Other

  • Save the document as a html file and then read the HTML code for the HEX code
  • Use a windows based colour picker and just select the font you want for the colour. You might find zooming in on the text to make it larger helps you here.

Links

Read 1121 times Last modified on Monday, 15 June 2015 09:29