javascript - 我可以使用 JavaScript 对特定像素的颜色进行采样吗?
问题描述
我目前正在开展一个项目,该项目可能会同时包含大量图像。所以我们的设计在图像底部放了一个小标题,作为覆盖,一个小::After
“箭头”指向下一部分。
叠加层大约有 10% 的透明,因此某些图像只是可见的,但根据图像,叠加层的颜色会有所不同 - 导致箭头不匹配。
请以这张图片为例:
有什么方法可以以编程方式对“箭头”附近的一个或平均像素进行采样,以便它始终获得正确的颜色,并且看起来无缝?
编辑:
.overlay-with-arrow
{
position: absolute;
bottom: 0;
width: 100%;
background-color: rgba(62, 62, 62, 0.9);
color: #FFF;
text-align: center;
font-family: Montserrat, SansSerif, serif;
text-transform: uppercase;
}
.overlay-with-arrow::after
{
content: "";
width: 0;
height: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid rgb(62, 62, 62);
display: block;
position: absolute;
transform: translateX(-50%);
left: 50%;
bottom: -20px;
z-index: 1;
}
解决方案
推荐阅读
- python - 错误“不支持在没有 --no-sandbox 的情况下以 root 身份运行”
- html - 无法通过修改边距移动 href 的位置
- react-native - TypeError: undefined is not an object (评估 props.navigation.navigate)
- linux - 使用命令行 Ubuntu 检查 NetworkManager 是 DHCP 还是静态
- python - 如何将图像的路径放入变量中并将其与 imread() 一起使用
- javascript - Firebase 可调用函数来读取实时数据库
- html - 仅显示当前选择性 div 并使用 jquery 隐藏其他 div
- html - CSS 媒体查询不响应给定的最大宽度或最小宽度
- python - 为什么 PIL 经常与 Pytorch 一起使用?
- javascript - 如何使用快速服务器在nodejs中将zip文件后端发送到前端