\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Themes HowTo}
\textbf{This information is valid for Horde 5 and later only. See <a href="https://wiki.horde.org/Doc/Dev/ThemesH3">Doc/Dev/ThemesH3</a> for Horde 3 or <a href="https://wiki.horde.org/Doc/Dev/ThemesH4">Doc/Dev/ThemesH4</a> for Horde 4.}

\section{Default Theme}
Each application defines a 'default' theme.  This default theme is used as the base of all other themes.  The default theme is not accessible to end users, and should not be altered when developing a new theme.

\section{User Preference Theme}
The default theme is then extended by the theme defined in the user's 'theme' preference entry.

Theme names MUST NOT contain an underscore.

\section{Theme Inheritance}
Theme elements are inherited in the following order:

\begin{itemize}
\item \textbf{application}/themes/\textbf{theme}


\item horde/themes/\textbf{theme}


\item \textbf{application}/themes/default


\item horde/themes/default


\end{itemize}
(The \textbf{application} entries listed above will be skipped if horde is the current application.)

For images \& sounds, the first matching item is used working down the inheritance tree.

For CSS, the inheritance order determines the order the stylesheets are output.  CSS files located at the top of the inheritance tree will be loaded \textit{LAST}, horde default stylesheets will be loaded \textit{FIRST} (to allow application definitions to trump Horde-wide defaults).  Additionally, stylesheets added via the 'cssfiles' hook will be loaded \textit{LAST}, after the application stylesheets.

\section{Theme Layout}
Themes are located in the themes/<a href="https://wiki.horde.org/themename">themename</a> directory.

\subsection{Subdirectories}
\subsubsection{View Subdirectories}
View specific subdirectories will be used if they exist in a theme.

<table class="horde-table">Directory & View \\
\hline
\texttt{basic} & Basic (traditional) \\
\hline
\texttt{dynamic} & Dynamic \\
\hline
\texttt{minimal} & Minimal \\
\hline
\texttt{smartmobile} & Smartmobile \\
\hline
</table>
\subsubsection{Reserved Subdirectories}
The following subdirectories are reserved for special Horde use:

<table class="horde-table">Directory & Description \\
\hline
\texttt{block} & CSS to use for an application's portal block \\
\hline
</table>
\subsection{CSS}
CSS files should normally go into the base theme directory.  There are several filenames that have special meaning in Horde:

<table class="horde-table">Filename & Description \\
\hline
\texttt{embed.css} & Used for embedded display \\
\hline
\texttt{rtl.css} & Styles to use if the current language is a Right-to-Left language \\
\hline
\texttt{screen.css} & The default CSS definition \\
\hline
</table>
Additionally, the following CSS files will be automatically added based on the current browser:

<table class="horde-table">Filename & Browser \\
\hline
\texttt{ie8.css} & Internet Explorer 8 \\
\hline
\texttt{opera.css} & Opera \\
\hline
\texttt{mozilla.css} & Mozilla-based browser (i.e. Firefox) \\
\hline
\texttt{webkit.css} & Webkit-based browser (i.e. Google Chrome, Safari) \\
\hline
</table>
URLs contained in CSS should be relative URLs.

\subsection{Graphics}
Graphics live in the \texttt{graphics/} folder.  Prior to Horde\_Core v2.4.0, the graphics folder could only live in the base theme directory.  After Horde\_Core v2.4.0, any view-specific directory can contain a graphics folder which will override the default graphics.

It is highly recommended that images are delivered in PNG format.

\subsection{Sounds}
Sounds live in the \texttt{sounds/} folder.  Prior to Horde\_Core v2.4.0, the sounds folder could only live in the base theme directory.  After Horde\_Core v2.4.0, any view-specific directory can contain a sounds folder which will override the default sounds.

Sounds must be in WAV format (with a \texttt{.wav} file suffix).

\subsection{Information File}
\textbf{This file is only needed in the horde theme directory. It is not needed in an applications' theme directory}

The \texttt{info.php} contains information regarding the theme.  It must be a file that can be parsed by PHP.  It should contain the following variables:

<table class="horde-table">Variable Name & Description \\
\hline
\$theme\_name & This is the theme name as it will appear in the theme list in the users' display options. \\
\hline
</table>
An example for info.php:

<pre><code class="language-php">
<?php
/**
 * This is my personal theme.
 * It is based on the colors of my bike when I was five.
 *
 * @author John Doe <john@example.com>
 */
\$theme\_name = \_("My Theme Name");
</code></pre>
\section{Adding Non-Theme CSS files}
It may be useful/necessary to add a CSS file to the output and not include it with the theme output.  For example, there may be CSS code shared between the Traditional and Smartmobile views (using themed CSS, these views \textbf{never} have shared CSS).  To explicitly add a file that lives in the base of the theme directory (example file: \texttt{example.css}), this code can be used:

<pre><code class="language-php">
\$css = new Horde\_Themes\_Element('example.css');
\$GLOBALS['page\_output']->addStylesheet(\$css->fs, \$css->uri);
</code></pre>
\end{document}
