Skip to content

Instantly share code, notes, and snippets.

@Malleys
Created June 3, 2018 13:51
Show Gist options
  • Save Malleys/80bd635c8ab26d93ce99393e824554f2 to your computer and use it in GitHub Desktop.
Save Malleys/80bd635c8ab26d93ce99393e824554f2 to your computer and use it in GitHub Desktop.
The problem with brightness()
/**
* 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);
}
<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>
// alert('Hello world!');
{"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