根据样式表更改图像

Is it possible to switch out images based on what stylesheet is being used on the page?

For example, I have a normal and a nightview stylesheet which users can switch between. Although I'm guessing the solution might be with CSS, here's my pseudocode attempt in PHP:

        $css = "/.css"
        if (css=normal.css){    
            echo "<img src='1.1.1.jpg'>";
        }
        if (css=nightview.css){ 
            echo "<img src='1.1.1i.jpg'>";
        }

Any tips on how to make this happen?

Store first the users selected theme (normal,nightview) inside a SESSION or a Cookie then echo it out on your link header.

<link href="<?php echo $myCss;?>" rel="stylesheet" />

Now inside the css you can target the image using a id or class and change that image or any element accordingly.

#MyImage {

 background-image: url("black.png");

}