2 **Note:** You have already read the [Module Reference](./Modules.md) and the [Template Reference](./Templates.md).
4 We assume you want to call your new theme `mytheme`.
5 Replace `mytheme` with your module name every time this is mentioned in this Howto.
7 ## Creating the structure
8 At first create a new theme directory `themes/luci-theme-mytheme`.
10 Create a `Makefile` inside your theme directory with the following content:
12 include $(TOPDIR)/rules.mk
14 LUCI_TITLE:=Title of mytheme
17 # call BuildPackage - OpenWrt buildroot signature
20 Create the following directory structure inside your theme directory.
35 Create two LuCI HTML-Templates named `header.htm` and `footer.htm` under `luasrc/view/themes/mytheme`.
36 The `header.htm` will be included at the beginning of each rendered page and the `footer.htm` at the end.
37 So your `header.htm` will probably contain a DOCTYPE description, headers,
38 the menu and layout of the page and the `footer.htm` will close all remaining open tags and may add a footer bar.
39 But hey that's your choice: you are the designer ;-).
41 Just make sure your `header.htm` begins with the following lines:
44 require("luci.http").prepare_content("text/html")
48 This ensures your content is sent to the client with the right content type.
49 Of course you can adapt `text/html` to your needs.
52 Put any stylesheets, Javascripts, images, ... into `htdocs/luci-static/mytheme`.
53 Refer to this directory in your header and footer templates as: `<%=media%>`.
54 That means for a stylesheet `htdocs/luci-static/mytheme/cascade.css` you would write:
56 <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
59 ## Making the theme selectable
60 If you are done with your work there are two last steps to do.
61 To make your theme OpenWrt-capable and selectable on the settings page, create a file `root/etc/uci-defaults/luci-theme-mytheme` with the following contents:
65 set luci.themes.MyTheme=/luci-static/mytheme
71 and another file `ipkg/postinst` with the following content:
74 [ -n "${IPKG_INSTROOT}" ] || {
75 ( . /etc/uci-defaults/luci-theme-mytheme ) && rm -f /etc/uci-defaults/luci-theme-mytheme
79 This correctly registers the template with LuCI when it gets installed.
81 That's all. Now send your theme to the LuCI developers to get it into the development repository - if you like.