Skip to content

Instantly share code, notes, and snippets.

@LeaVerou
Last active June 1, 2018 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeaVerou/7f2ff9150c496e080e5731152288844a to your computer and use it in GitHub Desktop.
Save LeaVerou/7f2ff9150c496e080e5731152288844a to your computer and use it in GitHub Desktop.
Converting between colors with filters
/**
* Converting between colors with filters
*/
div div {
width: 200px;
height: 200px;
background: var(--color);
xfilter: grayscale() brightness(10000%);
}
body > div {
display: flex;
}
.fake div {
background: red;
}
.fake div:nth-child(1) {
filter: hue-rotate(81deg) saturate(43%) brightness(241%);
}
.fake div:nth-child(2) {
filter: hue-rotate(187deg) brightness(185%) saturate(69%);
}
.fake div:nth-child(3) {
filter: grayscale(100%) brightness(299%);
}
<div>
<div style="--color: #75AF26; /* HSB: 85, 78%, 69% */"></div>
<div style="--color: #15B6D2 /* HSB: 189, 90%, 82% */"></div>
<div style="--color: hsl(0, 0%, 63%)"></div>
</div>
<div class="fake">
<div></div>
<div></div>
<div></div>
</div>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment