Playing with CSS and Ruby
Written on February 04, 2010 with the tags Ruby, Rakefile, and HexSo I’m playing with a new idea of generating hexcodes based on the time of when the post was created. As it is now 12am, the hex code is #000000, black and boring, but it generates other colors based on the military time. Here’s the Ruby code I wrote to generate the hexcode.
def time_hex t = Time.now.strftime("%H") t = Integer(t) * 0.041666 return ["%06x" % (t * 0xffffff)]end
You just need to throw that in your rakefile and put the hexcode: #{time_hex} in your haml/yaml header. Neato!
Now I just need to edit the CSS to link to each of the posts “hexcode” header.
Update: It’s now 1:30am, and I cant get Jekyll to read the hexcode from the post header. I want to shoot someone because I just keep beating my head against this. I don’t like the idea of having an idea and not being able to see it through. Enough for tonight, I’ll try again later.