Home | Blog
New website colors11/18/2022
Playing around with the colors of my site, I noticed that it didn't just look good in blue, but in others as well. Due to this, I decided I would try to make a randomization of colors that it would display in. This was done by replacing style.css with a style.jsp.
To actually do the color rotation, I utilized Java's Color.RGBtoHSB and Color.HSBtoRGB methods to convert between RGB and HSB, where the hue can be more easily shifted. Though it poses the problem of inconsistent color lightness. Converting the RGB colors to linear makes them easier to compare. I chose three colors that I perceived as being equal lightness. Those RGB triplets were (240, 0, 0), (0, 166, 0), and (0, 0, 255). Converting these colors to linear and treating their channel values' reciprocals as weights, I computed lightness this way and used the initial and ending lightness (of the hue shift) to calculate the amount the resulting color would need to be scaled. This scaling happening, of course, in linear RGB.
Overall, I think I am satisfied with how it turned out. Initially I had thought this would work best as something that would vary by time of day, but for now I think random works fine.
Currently the color scheme changes do not accommodate the background image (which was made specifically for the blue theme), but for now will leave it where it is. I may make a few different versions and have it choose whichever is nearest to the chosen hue shift.