html - 反转图像颜色
问题描述
我有一个要在 vue 模板中导入的图像,并且图像是黑色的。我希望图像是这种颜色(#0768fd)如何得到这个。
我尝试分配类和样式,但没有用
<img alt="icon"
:src="require(`@/assets/images/group-icon.png`) "
class="icon-class invert"/>
.icon-class {
width: 24px !important;
height: 24px !important;
margin: 0 6px 0 0;
padding: 2px;
color:#0768fd;
background-color:#0768fd;
border-radius: 50%;
border: solid 1px black !important;
}
.invert {
filter: invert(0.6);
}
解决方案
生成 CSS 过滤器(足够接近)以针对 HEX 代码:https ://codepen.io/sosuke/pen/Pjoqqp
img {
height: 68px;
filter: invert(26%) sepia(100%) saturate(1711%) hue-rotate(207deg) brightness(99%) contrast(111%);
}
<img src="https://image.flaticon.com/icons/png/512/32/32441.png" alt="" />
推荐阅读
- c - NCURSES color_contents 函数未返回正确的颜色强度
- javascript - 图像在悬停+增长时跳出其绝对位置
- python - 将烧瓶应用程序部署到heroku时,dbus-python无法安装
- fortran - 宽度为零的格式描述符,如 F0.6 或 G0.8
- visual-studio-2017 - 为什么新surface pro上VS 2017没有发布功能
- hp-uft - 启动 UFT 应用程序会使 Cortana 使用更多 CPU 并且反应更慢
- mysql - mySQL 8 中带有 order by、limit 和括号的奇怪行为
- r - 原始文件中的变量按行组织。R如何正确读取它?
- mysql - 创建新字段后在mysql中插入新数据
- python - 添加多个变量,同一行?