Skip to content

Instantly share code, notes, and snippets.

@lkallioniemi
Created August 26, 2016 06:38
Show Gist options
  • Save lkallioniemi/dc5a1891486512215ac5e03aaabbb209 to your computer and use it in GitHub Desktop.
Save lkallioniemi/dc5a1891486512215ac5e03aaabbb209 to your computer and use it in GitHub Desktop.
Colorblind filters
javascript:var%20svg=document.createElementNS('http://www.w3.org/2000/svg','svg');var%20filter=document.createElementNS('http://www.w3.org/2000/svg',%20'filter');filter.setAttribute('id',%20'f2');var%20colorMatrix=document.createElementNS('http://www.w3.org/2000/svg',%20'feColorMatrix');colorMatrix.setAttribute('values','0.4251%200.6934%20-0.1147%200%200%200.3417%200.5882%200.0692%200%200%20-0.0105%200.0234%200.9870%200%200%200%200%200%201%200');filter.appendChild(colorMatrix);svg.appendChild(filter);document.body.appendChild(svg);document.body.setAttribute('style','-webkit-filter:url(%23f2);-moz-filter:url(%23f2);-ms-filter:%20url(%23f2);-o-filter:%20url(%23f2);filter:%20url(%23f2)');
javascript:var%20svg=document.createElementNS('http://www.w3.org/2000/svg','svg');var%20filter=document.createElementNS('http://www.w3.org/2000/svg',%20'filter');filter.setAttribute('id',%20'f1');var%20colorMatrix=document.createElementNS('http://www.w3.org/2000/svg',%20'feColorMatrix');colorMatrix.setAttribute('values','0.56667%200.43333%200.00000%200%200%200.55833%200.44167%200.00000%200%200%200.00000%200.24167%200.75833%200%200%200%200%200%201%200');filter.appendChild(colorMatrix);svg.appendChild(filter);document.body.appendChild(svg);document.body.setAttribute('style','-webkit-filter:url(%23f1);-moz-filter:url(%23f1);-ms-filter:%20url(%23f1);-o-filter:%20url(%23f1);filter:%20url(%23f1)');
javascript:var%20svg=document.createElementNS('http://www.w3.org/2000/svg','svg');var%20filter=document.createElementNS('http://www.w3.org/2000/svg',%20'filter');filter.setAttribute('id',%20'f3');var%20colorMatrix=document.createElementNS('http://www.w3.org/2000/svg',%20'feColorMatrix');colorMatrix.setAttribute('values','0.95000%200.05000%200.00000%200%200%200.00000%200.83333%200.16700%200%200%200.00000%200.87500%200.12500%200%200%200%200%200%201%200');filter.appendChild(colorMatrix);svg.appendChild(filter);document.body.appendChild(svg);document.body.setAttribute('style','-webkit-filter:url(%23f3);-moz-filter:url(%23f3);-ms-filter:%20url(%23f3);-o-filter:%20url(%23f3);filter:%20url(%23f3)');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment