Theming Photivo’s GUI

To achieve its unique look and the ability to switch between different themes Photivo mostly relies on Qt’s styling abilities around QPalette, QStyle and QSS stylesheets. On top of that ptTheme has its own stylsheet format and parser to avoid duplicated stylesheets and define colour variables in one single place instead of putting the actual colour values wherever you need them.

At the moment it is not possible to add new themes without making changes to the C++ source code as well. You can alter the existing themes, but consider this to be at your own risk.

Theme Tweaking with Custom Stylesheets

To tweak some aspects of a theme without touching the “official” theming files the best way is to use a custom QSS stylesheet. QSS is Qt’s version of the web world’s CSS stylesheets. Basically it’s CSS with several Qt specific additions.

Assuming you know a bit about CSS, a good place to start is the Qt Stylesheet documentation. For writing a custom stylesheet you’ll want to keep the style sheets reference and examples handy. Also the Photivo.qss file in Photivo’s Themes subfolder is a good reference. There the major part of Photivo’s built-in themes are defined.

Things to keep in mind:

Photivo Themes Explained

A Photivo theme consists of a .ptheme file defining variables and one or more .qss files defining the actual style rules. For example the default Dark grey style is defined in DarkGrey.ptheme, Photivo.qss, Photivo.windows.qss and Photivo.linux.qss.

Photivo’s theme files are not intended to be edited by users. The theme parser is not error tolerant! It will break quickly if you don’t stick to the rules.

The @Variables section defines global color values and paths to graphical elements. Access them anywhere in the QSS as $VariableName$.

absolute or relative to the .qss file’s location.

The @import specifies the theme’s QSS files.