-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plus-lighter blend mode tests (#31757)
- Loading branch information
1 parent
ad10652
commit 2f7da96
Showing
12 changed files
with
354 additions
and
115 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
css/compositing/background-blending/background-blend-mode-plus-lighter.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<title>background-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Jake Archibald" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> | ||
<link rel="match" href="reference/background-blend-mode-plus-lighter-ref.html"> | ||
<style> | ||
.test { | ||
width: 100px; | ||
height: 100px; | ||
background-blend-mode: plus-lighter; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { tests } from '../support/plus-lighter.js'; | ||
import { toCSSColor } from '../support/utils.js'; | ||
|
||
// Create a solid color CSS image. | ||
const colorImage = (pixel) => | ||
`linear-gradient(to right, ${toCSSColor(pixel)}, ${toCSSColor(pixel)})`; | ||
|
||
const createBackgrounds = (colors) => colors | ||
// Backgrounds are top first | ||
.slice().reverse() | ||
.map((color) => colorImage(color)) | ||
.join(', '); | ||
|
||
for (const colors of tests) { | ||
document.body.insertAdjacentHTML('beforeend', ` | ||
<div class="test" style="background-image: ${createBackgrounds(colors)}"></div> | ||
`); | ||
} | ||
</script> |
20 changes: 20 additions & 0 deletions
20
css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<title>background-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Jake Archibald" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> | ||
<style> | ||
.test { | ||
width: 100px; | ||
height: 100px; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { tests, plusLighter } from '../../support/plus-lighter.js'; | ||
import { toCSSColor } from '../../support/utils.js'; | ||
|
||
for (const colors of tests) { | ||
document.body.insertAdjacentHTML('beforeend', ` | ||
<div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> | ||
`); | ||
} | ||
</script> |
42 changes: 42 additions & 0 deletions
42
css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
<link rel="match" href="reference/mix-blend-mode-plus-lighter-basic-ref.html"> | ||
|
||
<style> | ||
.container { | ||
position: relative; | ||
isolation: isolate; | ||
width: 500px; | ||
height: 500px; | ||
} | ||
.blue { background: #000064; } | ||
.green { background: #006400; } | ||
.common { | ||
position: absolute; | ||
width: 100px; | ||
height: 100px; | ||
opacity: 0.6; | ||
} | ||
.one { | ||
top: 10px; | ||
left: 10px; | ||
} | ||
.two { | ||
top: 65px; | ||
left: 30px; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
.three { | ||
top: 120px; | ||
left: 50px; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
</style> | ||
|
||
<div class=container> | ||
<div class="one common blue"></div> | ||
<div class="two common blue"></div> | ||
<div class="three common green"></div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter SVG test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> | ||
|
||
<style> | ||
.isolate { isolation: isolate; } | ||
rect { | ||
opacity: 0.6; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
</style> | ||
|
||
<svg width=500 height=500> | ||
<g class="isolate"> | ||
<rect x="10" y="10" width="100" height="100" fill="#000064"></rect> | ||
<rect x="30" y="65" width="100" height="100" fill="#000064"></rect> | ||
<rect x="50" y="120" width="100" height="100" fill="#006400"></rect> | ||
</g> | ||
</svg> |
44 changes: 30 additions & 14 deletions
44
css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,37 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter SVG test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> | ||
|
||
<style> | ||
.isolate { isolation: isolate; } | ||
rect { | ||
opacity: 0.6; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
.blend-group { | ||
isolation: isolate; | ||
} | ||
.layer { | ||
mix-blend-mode: plus-lighter; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { tests } from '../support/plus-lighter.js'; | ||
import { toCSSColor } from '../support/utils.js'; | ||
|
||
function createRects(colors) { | ||
let html = ''; | ||
|
||
for (const color of colors) { | ||
html += `<rect class="layer" x="0" y="0" width="100%" height="100%" fill="${toCSSColor(color)}" />`; | ||
} | ||
|
||
return html; | ||
} | ||
|
||
<svg width=500 height=500> | ||
<g class="isolate"> | ||
<rect x="10" y="10" width="100" height="100" fill="#000064"></rect> | ||
<rect x="30" y="65" width="100" height="100" fill="#000064"></rect> | ||
<rect x="50" y="120" width="100" height="100" fill="#006400"></rect> | ||
</g> | ||
</svg> | ||
for (const colors of tests) { | ||
document.body.insertAdjacentHTML('beforeend', ` | ||
<svg width="100" height="100"> | ||
<g class="blend-group"> | ||
${createRects(colors)} | ||
</g> | ||
</svg> | ||
`); | ||
} | ||
</script> |
66 changes: 31 additions & 35 deletions
66
css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,38 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
<link rel="match" href="reference/mix-blend-mode-plus-lighter-ref.html"> | ||
|
||
<style> | ||
.container { | ||
position: relative; | ||
isolation: isolate; | ||
width: 500px; | ||
height: 500px; | ||
} | ||
.blue { background: #000064; } | ||
.green { background: #006400; } | ||
.common { | ||
position: absolute; | ||
width: 100px; | ||
height: 100px; | ||
opacity: 0.6; | ||
} | ||
.one { | ||
top: 10px; | ||
left: 10px; | ||
} | ||
.two { | ||
top: 65px; | ||
left: 30px; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
.three { | ||
top: 120px; | ||
left: 50px; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
.test { | ||
width: 100px; | ||
height: 100px; | ||
position: relative; | ||
isolation: isolate; | ||
} | ||
.layer { | ||
position: absolute; | ||
inset: 0; | ||
mix-blend-mode: plus-lighter; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { tests } from '../support/plus-lighter.js'; | ||
import { toCSSColor } from '../support/utils.js'; | ||
|
||
function createLayers(colors) { | ||
let html = ''; | ||
|
||
for (const color of colors) { | ||
html += `<div class="layer" style="background-color: ${toCSSColor(color)}"></div>`; | ||
} | ||
|
||
return html; | ||
} | ||
|
||
<div class=container> | ||
<div class="one common blue"></div> | ||
<div class="two common blue"></div> | ||
<div class="three common green"></div> | ||
</div> | ||
for (const colors of tests) { | ||
document.body.insertAdjacentHTML('beforeend', ` | ||
<div class="test">${createLayers(colors)}</div> | ||
`); | ||
} | ||
</script> |
57 changes: 57 additions & 0 deletions
57
css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
|
||
<style> | ||
.container { | ||
isolation: isolate; | ||
position: relative; | ||
width: 500px; | ||
height: 500px; | ||
} | ||
.blue { background: #000064; } | ||
.green { background: #006400; } | ||
.common { | ||
position: absolute; | ||
width: 100px; | ||
height: 100px; | ||
opacity: 0.6; | ||
} | ||
.one { | ||
top: 10px; | ||
left: 10px; | ||
} | ||
.two { | ||
top: 65px; | ||
left: 30px; | ||
} | ||
.three { | ||
top: 120px; | ||
left: 50px; | ||
} | ||
.one_and_two { | ||
position: absolute; | ||
width: 80px; | ||
height: 45px; | ||
top: 65px; | ||
left: 30px; | ||
background: #000078; | ||
} | ||
.two_and_three { | ||
position: absolute; | ||
width: 80px; | ||
height: 45px; | ||
top: 120px; | ||
left: 50px; | ||
background: #003C3C; | ||
} | ||
</style> | ||
|
||
<div class=container> | ||
<div class="one common blue"></div> | ||
<div class="two common blue"></div> | ||
<div class="three common green"></div> | ||
<div class="one_and_two"></div> | ||
<div class="two_and_three"></div> | ||
</div> |
65 changes: 14 additions & 51 deletions
65
css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,20 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> | ||
<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
|
||
<style> | ||
.container { | ||
isolation: isolate; | ||
position: relative; | ||
width: 500px; | ||
height: 500px; | ||
} | ||
.blue { background: #000064; } | ||
.green { background: #006400; } | ||
.common { | ||
position: absolute; | ||
width: 100px; | ||
height: 100px; | ||
opacity: 0.6; | ||
} | ||
.one { | ||
top: 10px; | ||
left: 10px; | ||
} | ||
.two { | ||
top: 65px; | ||
left: 30px; | ||
} | ||
.three { | ||
top: 120px; | ||
left: 50px; | ||
} | ||
.one_and_two { | ||
position: absolute; | ||
width: 80px; | ||
height: 45px; | ||
top: 65px; | ||
left: 30px; | ||
background: #000078; | ||
} | ||
.two_and_three { | ||
position: absolute; | ||
width: 80px; | ||
height: 45px; | ||
top: 120px; | ||
left: 50px; | ||
background: #003C3C; | ||
} | ||
.test { | ||
width: 100px; | ||
height: 100px; | ||
} | ||
</style> | ||
<script type="module"> | ||
import { tests, plusLighter } from '../../support/plus-lighter.js'; | ||
import { toCSSColor } from '../../support/utils.js'; | ||
|
||
<div class=container> | ||
<div class="one common blue"></div> | ||
<div class="two common blue"></div> | ||
<div class="three common green"></div> | ||
<div class="one_and_two"></div> | ||
<div class="two_and_three"></div> | ||
</div> | ||
for (const colors of tests) { | ||
document.body.insertAdjacentHTML('beforeend', ` | ||
<div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> | ||
`); | ||
} | ||
</script> |
19 changes: 19 additions & 0 deletions
19
css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<title>mix-blend-mode: plus-lighter SVG test</title> | ||
<link rel="author" title="Vladimir Levin" href="mailto:[email protected]"> | ||
<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> | ||
|
||
<style> | ||
.isolate { isolation: isolate; } | ||
.original { opacity: 0.6; } | ||
</style> | ||
|
||
<svg width=500 height=500> | ||
<g class="isolate"> | ||
<rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> | ||
<rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> | ||
<rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> | ||
<rect x="30" y="65" width="80" height="45" fill="#000078"></rect> | ||
<rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> | ||
</g> | ||
</svg> |
Oops, something went wrong.