Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The Default Theme
The default Kivy theme is loosely based on the Moblin mobile interface. Although we consider it simple and elegant, it may not suit everyone's needs.
There are various approaches to giving Kivy a new and unique look. These are described below including a discussion of their advantages and disadvantages.
The Simplest Approach
The background images for all the Kivy widgets are all pulled from the png file
<KIVY_DATA_DIR>/images/defaulttheme-0.png by using the .atlas file alongside it. You will also find other images in this folder that you can modify to change some other visual elements. Their names should be self-explanatory.
The 'defaulttheme-0.png' is used together with the
<KIVY_DATA_DIR>/style.kv file to apply the complete style - bitmaps and drawing instructions. This means that by altering these files, you can customize the look of your user interface.
As an alternative to replacing these files, you can create your own versions and use the resource_add_path function so Kivy uses them in preference to the defaults.
- Simple to implement
- Guaranteed compatibility (assuming no broken kv!)
- Easy to swap out and share
- Limited customizability
- Bitmaps may display poorly on hi-res displays
- The list of default individual images can be found on the tools/theming subfolder.
- Milos Bulatovic has prepared some themes which are freely available on his github account.
- An article on Theming in Kivy by Dusty Phillips covers some important concepts.
Heavily based on concepts used in Google's Material Design and the Windows "Modern" interface, this effort goes a little beyond just retheming the existing UI elements. A preview can be found on youtube.
One of the main goals of the project is to make theming an application significantly easier. Rather than specifying raw numbers for each UI element, FlatKivy provides user-definable lookup tables for font 'style' (a mixture of actual typeface, font_size, and opacity following google's typography recommendations), colors (the entirety of the color palette in the Material Design document is built in), and a system for defining a set of arbitrary theming rules for widgets that can be applied everywhere transparently. This creates UI elements that are human readable, faster and easier to work with for programmers and designers.
- Modern looking
- Scalable over different resolutions
- Based on Google usability studies
- Pioneering (few help resources available)
Rolling Your Own
Of course, you are free to create you own widgets or override the graphical properties (both background images and drawing instructions) of the default widgets to create an entirely unique look and feel for your app. This works well for simple widgets, but can quickly become a lot of work when using more complex widgets.
If you choose this route, be sure to consider the full scope of widgets you will require before taking the plunge.