Using themes

Creating dialogs requires a lot of information for the single elements. Which size is a font? Which font should be used? Which color should the background have, etc? Adding this information to each single widget results in lots of redundant information. If the same look should be applied to several widgets, the problem of changing each and every widget's properties gets annoying.

To download the code for this tutorial, fetch it from the git-repository by issuing:

git clone git://

Then you can follow this part by having a look at the tutorials firststeps/03 folder.

Theme classes

To face the problem of recurring properties disko makes use of classes. They are basically sets of widget properties bound to a name. These defintions are stored in a file named theme.xml in the theme folder themes/<cthemename>/. The default look of widgets could be changed there as well. In this example the theme is stored in themes/default/theme.xml.

<mmstheme name="default">
           name = "myLabelClass"
           type = "label"

  = "DejaVuSansMono.ttf"
           font.size = "18"
           alignment = "center"
           color     = "#999999ff"
           selcolor  = "#ccccccff"/>
           name = "default_rootwindow"
           type = "rootwindow"

           alignment = "center"
           w         = "100%"
           h         = "100%"
           bgcolor   = "#000000ff"
           opacity   = "255"

This puts the font settings for the label class myLabelClass and the default behaviour for the root window together. The label class could now be applied to the dialog.xml.

The theme.xml in the tutorial's directory is filled with more properties to try around with.

Dialog files using themes

The dialog file now looks far more friendly, as the long property lists have vanished.

        <label class="myLabelClass" name="label1"/>