You can't directly add opacity to a named colour so I will preserve the colour switching script and allow for shades of colour by using an absolutely positioned ::before pseudoelement as a background.