目录

Themes

优质
小牛编辑
129浏览
2023-12-01

Flarum "themes" are just extensions. Typically, you'll want to use the Frontend extender to register custom Less and JS. Of course, you can use other extenders too: for example, you might want to support settings to allow configuring your theme.

You can indicate that your extension is a theme by setting the "extra.flarum-extension.category" key to "theme". For example:


{
    // other fields
    "extra": {
        "flarum-extension": {
            "category": "theme"
        }
    }
    // other fields
}

All this will do is show your extension in the "theme" section in the admin dashboard extension list.

You can define new Less variables in your extension's Less files. There currently isn't an extender to modify Less variable values in the PHP layer, but this is planned for future releases.

Flarum doesn't currently have a comprehensive system that would support switching between themes. This is planned for future releases.