Create my own theme


#1

Hello fellows,
I want to make my own theme in the colors of my company. I know how to do that and did find the instruction already:

https://developer.matomo.org/guides/theming

But there’s one thing I don’t understand:

To create an empty theme, run the following command from Matomo’s root directory:
./console generate:theme

What does that mean? How to do this?


(Lukas Winkler) #2

Hi,

If you don’t want to create the needed files for the theme manually, you can use this small tool which creates the template automatically.

For this you need to run ./console generate:theme on the command line while in the Matomo directory.

If you don’t know how to do this or don’t like to use the command line, you can simply create the files yourself.

You can take a look at this theme for inspiration:


#3

Ah! It’s so easy! Thank you!!

I’ve just uploaded my theme folder in the plugin folder and have to activate in the theme section.
The only problem was: It’s very hard to find the theme administration, because it’s just a link in the text above the plugin list.

(I still have no idea how to find the “console”. But for now I don’t need it.)


(Lukas Winkler) #4

See


and

I definitely argue for making the themes more prominent, but it is hard to do without cluttering the UI too much.


#5

Okay, so I’m not alone. :grin:


#6

@Lukas
One more question:
I want to change colors that I found only in:

/core/Plugin/ThemeStyles.php

Do you have any ideas how to integrate this in an own theme?


(Lukas Winkler) #7

Hi,

Themes: Develop - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 has recently been updated to explain how to change the colors that have been defined in PHP.

You basicly have to add a function like this to your main pluginname.php file.

public function configureThemeVariables(Plugin\ThemeStyles $vars)
{
    $vars->colorBackgroundBase = '#000';
}

#8

Now I get it! That’s awesome – thank you! :blush: