Add a skin to Atrium

Skin vs. Theme

Atrium provides a way to quickly change key elements of the design with minimal fuss and very low maintenance costs. This method is called skinning -- if you ever created a WinAMP skin or similar, you'll be familiar with the concepts.

Of course if you have greater customization needs you can always create a full custom Drupal theme for Atrium. This HOWTO will cover the minimal skin approach. Please refer to the Drupal.org docs on theming for more information about the Drupal theme system.

Checklist

  1. Design custom overrides for skin, icon sprites
  2. Set up your skin's directory and info file
  3. Add your custom sprites and any other extra images needed for your skin
  4. Add any custom CSS needed for your skin
  5. Add spaces_design integration for your skin

Step by step

Scene is a skin provided with the Atrium package as an example that you can use to help you get started. This HOWTO will walk through the process taken to create Scene -- you can also get started quickly by making a copy of Scene with a different name and tinkering around.

1. Design custom overrides for skin, icon sprites

The Atrium base theme Ginkgo uses extensive use of sprites for its graphic components. This makes it simple to override large portions of the design with just a few files. In particular, there are 3 key sprites in Ginkgo:

  • sprite_base.png core UI elements found in the main page "canvas"
  • sprite_icons.png core feature icons
  • sprite_skin.png header/wrapper bleeds and elements

For your skin you will probably want to override sprite_skin.png and sprite_icons.png. Please be respectful when overriding the design of the main page canvas as developers who build custom features will have certain design expectations for this area of the page.

To create an override of one of the skins you can use a graphics program like GIMP, Photoshop or Inkscape. You should keep your images/textures within the same metrics/coordinates as the default skin (i.e. do not rearrange elements).

2. Set up your skin's directory and info file

To register your skin as a theme available to Drupal, add a directory and info file for it from your Atrium root directory:

$ mkdir sites/all/themes/scene
$ touch sites/all/themes/scene/scene.info

You can then edit scene.info and add information for your skin:

name = "Scene"
description = "Example skin for Open Atrium."
version = "0.1"
core = "6.x"
atrium = "1.x"
engine = "phptemplate"
base theme = "ginkgo"

stylesheets[screen][] = "scene.css"

admin[admin menu] = 1
admin[admin inline] = 0

features[] = ""

spaces_design_site = "#226688"
spaces_design_og = "#bb2233"
spaces_design_user = "#686058"

Key entries to take note of:

  • atrium this declares that this theme is compatible with Atrium. Themes without this key (e.g. default Drupal themes) will not be made available for use by Atrium.
  • base theme declares that this theme extends Ginkgo. Without this, you'll be starting from scratch rather than adding your customizations on top of Atrium's defaults.
  • spaces_design_site, spaces_design_og, spaces_design_user allow you to define the default colors for each of the different space types.

You can now enable and switch to your custom skin, although it won't look very different yet.

3. Add your custom sprites and any other extra images needed for your skin

You can add your custom sprites to your skin by creating an images (or other directory) and adding your sprites:

sites/all/themes/scene/images/footer.png
sites/all/themes/scene/images/sprite_icons_active.png
sites/all/themes/scene/images/sprite_icons.png
sites/all/themes/scene/images/sprite_skin.png
sites/all/themes/scene/images/texture.jpg

4. Add any custom CSS needed for your skin

We now let Atrium know to use the sprite overrides in our skin using our CSS file registered in scene.info (scene.css):

body.spaces-design { background:url(images/texture.jpg) repeat; }

body.spaces-design #page,
body.spaces-design #navigation,
body.spaces-design #page-header { background:transparent; }

.atrium-skin { background-image:url(images/sprite_skin.png); }

.views-field-feature span.spaces-feature,
#features-menu li a span.icon { background-image:url(images/sprite_icons.png); }

#features-menu li.active a span.icon { background-image:url(images/sprite_icons_active.png); }

Note that we use the background-image property for sprites and not the greedier background property. This allows all the background positioning and other behavior defined by Ginkgo to be preserved.

Scene adds some other minor CSS adjustments to the header, navigation, footer, etc. to fit its aesthetic better.

/**
* CSS adjustments ====================================================
*/
#page { border-bottom:0px; }

#navigation ul.space-links { padding:15px 0px 0px; }

#navigation ul.space-links li a { border-color:#fff; }

#footer {
  border-top:0px;
  padding:80px 0px 40px;
  background:url(images/footer.png) repeat-x;
  }

...

5. Add spaces_design integration for your skin

spaces_design allows any space (group, user, etc.) to have color and logo customizations. Ginkgo handles logos automatically, but you'll need to do a little extra to make sure your skin makes the most use of custom color choices.

The color CSS for customized spaces is generated dynamically from the spaces-design.tpl.php template. You can override it in your skin by adding it to the directory:

sites/all/themes/scene/spaces-design.tpl.php

In it you can manage which colors get assigned to which elements.

  • $color is the exact color selected by the user
  • $downshift is a darkened variant of the selected color
  • $upshift is a lightened variant of the selected color
<?php if ($color): ?>
<style type='text/css'>
body.spaces-design #features-menu li.active,
body.spaces-design #features-menu li a:hover,
body.spaces-design #global,
body.spaces-design #header,
body.spaces-design #branding,
body.spaces-design #content h2.block-title,
body.spaces-design #navigation ul.space-links li a:hover { background-color:<?php print $color ?>; }

  body.spaces-design #features-menu li.active a:hover { background-color:transparent; }

body.spaces-design #branding form input.form-text { background-color:<?php print $downshift ?>; }

body.spaces-design #branding,
body.spaces-design #navigation,
body.spaces-design #branding form input.form-text { border-color:<?php print $upshift ?>; }
</style>
<?php endif; ?>