2 posts found in (zastica)

About Those Colored Bars

You might be wondering what those colored bars on top of my content are. And you’re right to wonder, because it’s kind of strange and out of place. While I was redesigning my site, I ran into a problem — I wanted to be able to add a little visual flare to my site, but I kept running into a dead end. I tried a featured photo thing from my vast collection of photography, but that ended up being too hard to maintain. Eventually, I settled on what you see now - a series of 9 colored bars, but I gave it a twist.

You see, the colors change everyday, and I don’t have to do anything to make it happen. I just defined 4 sets of colors, one for winter, spring, summer, and fall, and then wrote up some code to calculate the gradient between each set, and then I show the color set for any given day based on where today is on the line from season to season.

My base scheme looks like this (HSV values):

$this->schemes = array(
    $this->starts['winter'] => array(
        array(223, 58, 26), array(202, 53, 75), array(209, 11, 98)
    ),
    $this->starts['spring'] => array(
        array(0, 33, 69), array(83, 31, 84), array(187, 64, 66) 
    ),
    $this->starts['summer'] => array(
        array(93, 87, 100), array(349, 95, 100), array(33, 100, 100)
    ), 
    $this->starts['fall'] => array(
        array(0, 80, 85), array(35, 80, 85), array(45, 95, 60)
    )
);

I expand those sets of 3 into sets of nine by rotating the H value 36° to the left and right. Then I convert the values to RGB, and for each set I calculate the median values like this, with a distance of .5 (meaning half the distance between each point). This is done for each of the R, G, and B values.

foreach($from_vars as $i => $value) {
    if($value > $to_vars[$i]) {
        $diff = $value - $to_vars[$i];
        $from_vars[$i] = $to_vars[$i] + ($diff * $distance);
    }
    else {
        $diff = $to_vars[$i] - $value;
        $from_vars[$i] = $value + ($diff * $distance);
    }

    $from_vars[$i] = round($from_vars[$i], 0);
}

Basically, it just averages the two colors and applies those values to the date in between the start and end. It’s actually a lot more complicated than that, but that wouldn’t fit in one post.

Hello, World

This is my first post using my new CMS. It’s called HepCMS, and I developed it over the course of 6 months on my bus rides to and from work. My main goal while developing Hep was to create a simple system that would make it incredibly easy to publish content for the web. I also wanted to become more familiar with the CakePHP framework. At work, I develop and customize our custom CMS, so I also wanted a different system that would encourage me to learn in different ways.

And also, the technology that my old site used (the Symphony CMS) issued a major upgrade to their codebase, one that was incompatible with old Symphony websites. Since I was stuck in a situation where I couldn’t upgrade without some major effort, I decided to take the plunge and create my own system.

As for my old website, it’s now been archived for posterity. The content remains, albeit on a different url, and it is no longer supported or updated. Commenting is turned off, and the backend has been removed. I thought about porting the content into the new website, but honestly there was so much cruft that it wasn’t worth the effort.

The topic(s) of this site will remain the same — anything that comes to mind. And the quest to write interesting information will continue.