2

I have a image which I can apply apply colour tint, original image:

original image When background is applied

when background color applied.

I'm using CSS to change the colour:

<html>
  <head>
  <style type="text/css">
    div.background
     {
     width:480px;
     height:300px;
     background:url(whiteroom.jpg) repeat;
     }
   div.transbox
    {
     width:480px;
     height:300px;
     background-color:#FF3E96;
     opacity:0.5;
     filter:alpha(opacity=60); /* For IE8 and earlier */
     }
     </style>
    </head>
<body>
  <div class="background">
  <div class="transbox">
  </div>
  </div>
  </body>
</html>

How can I use javascript and CSS to change an image to reflect the selected colour. I don't need to able choose from different colours, all I need is one colour and different shades of that colour that I can select, for example a chose of different of pink shades.

Thank you :)

1

1 Answer 1

1

You can use CSS:

<div class="background">
  <div id="tint" class="transbox blue"></div>
</div>


div.transbox.blue {
      background-color:#0000ff;   
}

JS:

document.getElementByClassName('tint').setAttribute('class', 'transbox blue')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.