2

I have some trouble with my trac installation (version 11.4). What should I do to change i.e. some colors in the default theme? I've found various tips in the net, but nothing worked yet as most tips were for the 10.x version.

Are there any options in trac.ini or should I add a special xyz.css somewhere in my environment?

Please help me, I don't like the default black & white design ;)

Zappi
  • 451
  • 3
  • 8

2 Answers2

3

Instructions for how to do this for version 0.11 can be found at the Trac site, here's an example from that page that adds custom CSS as well as a header and a footer.

Say you want to add a link to a custom stylesheet, and then your own header and footer. Create a file /path/to/env/templates/site.html or /path/to/inherit/option/templates_dir/site.html, with contents like this:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      py:strip="">

  <!--! Add site-specific style sheet -->
  <head py:match="head" py:attrs="select('@*')">
    ${select('*')}
    <link rel="stylesheet" type="text/css"
          href="${href.chrome('site/style.css')}" />
  </head>

  <body py:match="body" py:attrs="select('@*')">
    <!--! Add site-specific header -->
    <div id="siteheader">
      <!--! Place your header content here... -->
    </div>

    ${select('*|text()')}

    <!--! Add site-specific footer -->
    <div id="sitefooter">
      <!--! Place your footer content here... -->
    </div>
  </body>
</html>
Adam Bellaire
  • 108,003
  • 19
  • 148
  • 163
  • But this changes the whole template. Do I have to copy the default template into my templates directory and add my custom css code? – Zappi Sep 04 '09 at 12:09
  • @Zappi: That's what we've done. I don't know of any other way to go about it. The way Genshi works I think you have modify the main template to get your custom CSS included. But I am by no means an expert with Genshi. :) – Adam Bellaire Sep 04 '09 at 12:23
  • Adams answer was right, thank you. I thought this would replace the template, but all the select(...) stuff refers to tracs default template. Genshi allows some sort of 'inheritance'. You can select parts of the parents file and import them to your own template. See http://genshi.edgewall.org/wiki/GenshiTutorial#AddingaLayoutTemplate So this code imports everything from and and adds and two
    to the page.
    – Zappi Sep 04 '09 at 14:11
  • And where do you create style.css? In my case the style.css get 404 error even if i included it into envdir\templates\site\style.css. – Tomas Kubes Jan 07 '14 at 08:54
2

Another option is to install a Trac Theme.

RjOllos
  • 2,900
  • 1
  • 19
  • 29
  • That page has no content. Did it before? – naught101 Mar 02 '16 at 06:10
  • That's a good idea. A related idea would be to have [ThemeEnginePlugin](https://trac-hacks.org/wiki/ThemeEnginePlugin) display a gallery of screenshots and provide for one-click install. – RjOllos Mar 02 '16 at 23:42