Created
June 3, 2018 13:51
-
-
Save Malleys/80bd635c8ab26d93ce99393e824554f2 to your computer and use it in GitHub Desktop.
The problem with brightness()
This file contains hidden or 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
/** | |
* The problem with brightness() | |
*/ | |
body { | |
display: flex; | |
} | |
div { | |
width: 150px; | |
height: 150px; | |
background: hsl(210, 50%, 30%); | |
color: white; | |
padding: 25px; | |
} | |
div:nth-child(1) { | |
filter: brightness(250%); | |
} | |
div:nth-child(3) { | |
background: hsl(210, 50%, 75%); | |
} | |
div:nth-child(4) { | |
filter: url(#brightness); | |
} |
This file contains hidden or 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
<div>filter: brightness(250%)</div> | |
<div>original color</div> | |
<div>lightness *= 2.5</div> | |
<div>filter: url(#brightness)</div> | |
<svg> | |
<filter id="brightness"> | |
<feComponentTransfer> | |
<feFuncR type="linear" slope="2.5"/> | |
<feFuncG type="linear" slope="2.5"/> | |
<feFuncB type="linear" slope="2.5"/> | |
</feComponentTransfer> | |
</filter> | |
</svg> |
This file contains hidden or 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
// alert('Hello world!'); |
This file contains hidden or 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
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment