Flatpak: Where are user created Color Schemes stored?

I made my own colorscheme based off the default Dark one.

I want to export it but can’t find it anywhere.

With the flatpak, all user created files are in ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice/4/user

But I searched, and didn’t find a thing.

A file in ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice/4/user/registrymodifications.xcu references the theme to be in /org.openoffice.Office.UI/ColorScheme/ColorSchemes but that directory does not even exist.

...
<item oor:path="/org.openoffice.Office.UI/ColorScheme/ColorSchemes"><node oor:name="Augenfreundlich" oor:op="replace"><node oor:name="Links"><prop oor:name="Dark"
...

I looked at that file and indeed it seems to contain not only one, but all my configured colorschemes!

The file is not linted, which makes it incredibly hard to read. And putting everything into a multi-thousand-lines config…

Also, every color has a setting, even though I only changed 8 or so.

In the comment below I explain the steps to make that config mess usable and export it into a theme. I made a repo for this project, but have not tested if the resulting extensions (which can be installed) actually add a theme, as that theme already existed on my side.

1 Like

Colour palette is different, that is the colour palettes that you see when colouring text, backgrounds, cells, etc.

In my Windows installation, when I look inside registrymodifications.xcu for the modification I made, it is such a long line I think it is the entire description of the theme.
If I open the Office 2003 Blue installed theme under Additions/xxxxx I see a file Theme.xcu which again seems to be the entire description except for a thumbnail in png format.

.
More improvements are in hand or already implemented in the master file I believe so saving your theme separately from the registrymodifications.xcu might be possible in future versions. For the moment I would save a copy of your user folder as a backup.

1 Like

So I guess I need to go the hacky way and extract my color scheme from that huge XML file.

(using Linux and the flatpak directories)

1. Set name

interactively

read -p "What name should the colorscheme have? " SCHEMENAME

or static

SCHEMENAME=MyTheme

2. Format the file

It looks horrendous, using xmllint it can be made way more readable

cp ~/.var/app/org.libreoffice.LibreOffice/config/libreoffice/4/user/registrymodifications.xcu registrymods-unformatted.xcu

xmllint --format registrymods-unformatted.xcu > registrymods.xcu
rm -f registrymods-unformatted.xcu

3. Extract the colorscheme

awk '/<item oor:path="\/org.openoffice.Office.UI\/ColorScheme\/ColorSchemes">/,/<\/item>/' registrymods.xcu > colorscheme.xcu

4. Metadata XML stuff

Remove unfitting lines

sed -i '/item/d' colorscheme.xcu

Add this to the beginning:

sed -i '1i\
<?xml version="1.0" encoding="UTF-8"?>\
<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">\
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry"\
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\
  xmlns:install="http://openoffice.org/2004/installation" oor:name="UI"\
  oor:package="org.openoffice.Office">\
  <node oor:name="ColorScheme">\
    <node oor:name="ColorSchemes">' colorscheme.xcu

And this to the end:

cat >> colorscheme.xcu <<EOF
    <prop oor:name="CurrentColorScheme">
      <value>$SCHEMENAME</value>
    </prop>
  </node>
</oor:component-data>
EOF

Now format the file again to look nice

xmllint --format colorscheme.xcu > Theme.xcu
rm -f colorscheme.xcu

packaging

See my repo that I liked above

I used this project as source, as it has working theme extensions:

1 Like