# Since the DRY violation of repeating color codes in CSS bothered me,
# I made a meta-CSS in the form of a simplistic perl file
# The simplest way to do this in Perl is by using the built-in
# variable substitution mechanism (interpolation)
# Use this file index.css.tmpl.pl to generate index.css
# Don't change the target index.css manually
# Predefined color codes of my color scheme
$COLOR_BACKGROUND = "#E5E879";
$COLOR_HEADING_BACKGROUND = "#7C79E8";
$COLOR_SUBHEADING_BACKGROUND = "#97275C";
$COLOR_ALTERNATE_1 = "#E879AD";
$COLOR_ALTERNATE_2 = "#79E8B4";
$COLOR_ALTERNATE_3 = "#292797";
# Productive version:
# open CSS, ">index.css" or die "Can't open index.css";
# --- Codepad version, to see it work
*CSS = *STDOUT;
print CSS <<CSS_TEMPLATE;
/* index.css is a generated file. Do not change it manually.
Use the template index.css.tmpl.pl for changes */
body {
background-color:$COLOR_BACKGROUND;
}
h1 {
background-color:$COLOR_HEADING_BACKGROUND;
color:white;
padding:10px 0px;
text-align:center;
}
... and so on ...
CSS_TEMPLATE
close CSS;