Let Drupal Editors Pick a Color and use it in Template

I'm currently working on an image slider where each slide needs to have its own background color.

Letting editors choose a color is easy with the Color Field Module. Just install it, throw the Spectrum Color Picker into your libraries folder and add and configure a Color Field where ever it's needed. You can then simply access the user-entered color as a hex string in your template and use it to your liking (yea, that's one of the rare times where it's ok to use inline style, at least in my book).

Convert Hexadecimal Color Values to RGBa

I needed my color to have alpha transparency, however, the color value is only available as a hexadecimal string. Luckily I found this handy snippet to convert hex values to RGB(a), so thanks a lot to mekshq for sharing.

Just put it into your template.php and you're good to to to use hex2rgba() anywhere in your theme.

Drupal: Insert JavaScript for Every Page except Front Page

Just a quick reminder for myself how to simply load an asset only if a certain condition is true.

In template.php we need to implement template_preprocess_page() check our condition and load our script using drupal_add_js():

function MYTHEME_preprocess_page(&$vars) {
  // if we're NOT on the front page load a script from the currently active default theme
  if (!$vars['is_front']) {
    $active_theme = drupal_get_path('theme',$GLOBALS['theme']);

Drush Make on Domainfactory Hosting

Shortly before going completly mad I got this stuff working. By default Domainfactory runs php4.4.9-cgi when simply calling php on the command line. As Drush needs PHP5 I used to help myself by aliasing the drush command to call something like php5-53STABLE-CLI drush.php through my .bashrc file.

Turned out that wile this works more or less well for Drush itself it doesn't cut it for drush make. Long story short, there's a DRUSH_PHP variable. Once that gets fed with the path to a somewhat current version of PHP5 everything works well. Also, I don't have to call drush.php anymore. So here's my .bashrc:

alias drush="~/drush/drush"
export DRUSH_PHP=/usr/local/bin/php5-53STABLE-CLI

Happy Making!

Somehow this stopped working recently, the following Alias does work though: