简体   繁体   English

如何阻止Hue更改图像边框颜色Javascript

[英]How to stop Hue from changing Image Border Color Javascript

I'm currently making a program that allows you to change image properties at will. 我目前正在制作一个程序,允许您随意更改图像属性。 Whenever I change the image hue it will also change the image border color (if there is one). 每当我更改图像色调时,它也会更改图像边框颜色(如果有的话)。 Is there any way to avoid this and keep the border color to what it was set to? 有什么方法可以避免这种情况并使边框颜色保持其设置的原样? I haven't really tried anything since there's nothing on the internet and I have no idea how I could fix this. 我真的没有尝试过任何东西,因为互联网上没有任何东西,我也不知道该如何解决。

You can just wrap your image in a container of the same size. 您可以将图像包装在相同大小的容器中。 Apply filters to elements inside this container, and set the border on the container. 将过滤器应用于此容器内的元素,然后在容器上设置边框。

 .container { border: 16px solid red; width: 256px; height: 256px; } .container img { filter: hue-rotate(90deg); -webkit-filter: hue-rotate(90deg); } 
 <div class="container"> <img src="https://picsum.photos/id/888/256/256"> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM