mix-blend-mode

How to invert stroke text color depending on background

浪子不回头ぞ 提交于 2019-12-20 03:14:55
问题 I have 2 divs 50% width each. There is a huge header h1 which should have the color of these two divs. I have tried mix-blend-mode but it gives me some random colors when set to difference. My goal is to invert the colors but to keep the colors of the divs. This is a codepen file, I have tried to keep it as simple as possible: https://codepen.io/lukagurovic/pen/MLoZmj The final effect is supposed to look like on in this example: https://jsfiddle.net/1uubdtz6/ but I am not sure why doesn't it

Change text color to white on any non-white background

不羁岁月 提交于 2019-12-18 08:54:07
问题 Changing the text color to white when the background color is black works great using mix-blend-mode: difference . Move the mouse to the text to see the effect: const blackBox = document.querySelector(".black-box"); window.addEventListener('mousemove', function(event) { blackBox.style.left = `${event.pageX - 50}px`; blackBox.style.top = `${event.pageY - 50}px`; }); .wrapper { background-color: white; } h1 { position: relative; z-index: 2; color: white; mix-blend-mode: difference; } .black-box

mix-blend-mode issues in Chrome

女生的网名这么多〃 提交于 2019-12-12 08:42:24
问题 I've been trying to use the mix-blend-mode on a page that has contains instances of css opacity transitions. What appears to be happening is that the div containing the mix-blend-mode displays as it would without the blend mode during the transition, or rather, while the animation is in progress. I've only found it to be an issue in Chrome. In my example, while the div is transforming the blend-mode displays correctly over the image but not over the page background. Once the transition is

Isolation with CSS Mix-Blend-Modes: how to prevent elements from blending with parent

天大地大妈咪最大 提交于 2019-12-11 06:13:57
问题 I have tried this a lot of different ways, and cannot make it so that the .pink and .green divs blend with one another, but not the background color of the parent element, .wrapper. .wrapper { background-color: blue; height: 100vh; width: 100%; isolation: isolate; } .pink { background: hotpink; height: 80%; width: 50%; position: absolute; z-index: 1; top: 0; left: 10%; mix-blend-mode: multiply; } .green { background: limegreen; height: 80%; width: 50%; position: absolute; z-index: 1; top: 0;

Mix blend mode multiply while keeping text opaque?

与世无争的帅哥 提交于 2019-12-11 03:37:53
问题 I need some help recreating this in CSS (if possible) : And here is a fiddle with what I have so far. There is a div with a background image and overlaying that div is another one with a red bg color and mix-blend-mode: multiply on it. It looks like the color blend is working correctly, but is there a way that I can make the white text be unaffected and an opaque solid white like in the example image? 回答1: You may use pseudo element and apply mix-blend-mode: multiply on it like this : .bg {

mix-blend-mode issues in Chrome

拥有回忆 提交于 2019-12-04 05:06:33
I've been trying to use the mix-blend-mode on a page that has contains instances of css opacity transitions. What appears to be happening is that the div containing the mix-blend-mode displays as it would without the blend mode during the transition, or rather, while the animation is in progress. I've only found it to be an issue in Chrome. In my example, while the div is transforming the blend-mode displays correctly over the image but not over the page background. Once the transition is complete it goes back to display as it should. In other words the blended div appears as solid yellow on

How to invert stroke text color depending on background

扶醉桌前 提交于 2019-12-01 23:13:43
I have 2 divs 50% width each. There is a huge header h1 which should have the color of these two divs. I have tried mix-blend-mode but it gives me some random colors when set to difference. My goal is to invert the colors but to keep the colors of the divs. This is a codepen file, I have tried to keep it as simple as possible: https://codepen.io/lukagurovic/pen/MLoZmj The final effect is supposed to look like on in this example: https://jsfiddle.net/1uubdtz6/ but I am not sure why doesn't it work with these colors. Also, these divs are interactive so the color has to change dynamicly as divs

How to use CSS combination of mix-blend-mode and isolation?

风流意气都作罢 提交于 2019-12-01 18:24:31
I have a parent element with a red background. I want an h2 element to blend just some words with the background, and other words, inside a span tag, no. My example below is not working. How to make it work? .bg-red { background: red; } .blend { mix-blend-mode: difference; color: white; } .isolate { isolation: isolate; } <div class="bg-red"> <div class="blend"> <h2>This text should <span class="isolate">(This one shouldn't)</span> be blended </h2> </div> </div> View on JSFiddle In order to make it working you need to specify the isolation before applying the mix-blend-mode . So between the

Invert colored text related background

这一生的挚爱 提交于 2019-12-01 08:19:09
I want to invert text color based on the background of the text, like in this image: . So I've tried the following code, but it didn't work: #warp, #text, #tri { position: absolute; top: 0; left: 0; width: 150px; height: 150px; z-index: 1; } #warp { background-color: orange; } #text { text-align: center; z-index: 3; } #text h1 { margin: 0; line-height: 150px; mix-blend-mode: difference; } #tri { background-color: black; clip-path: polygon(0 0, 0 100%, 99.8% 150px); -webkit-clip-path: polygon(0 0, 0 100%, 99.8% 150px); z-index: 2; } <div id="warp"> <div id="text"> <h1>TEXT</h1> </div> <div id=

Invert colored text related background

烂漫一生 提交于 2019-12-01 06:26:50
问题 I want to invert text color based on the background of the text, like in this image: . So I've tried the following code, but it didn't work: #warp, #text, #tri { position: absolute; top: 0; left: 0; width: 150px; height: 150px; z-index: 1; } #warp { background-color: orange; } #text { text-align: center; z-index: 3; } #text h1 { margin: 0; line-height: 150px; mix-blend-mode: difference; } #tri { background-color: black; clip-path: polygon(0 0, 0 100%, 99.8% 150px); -webkit-clip-path: polygon