Skip to content

Instantly share code, notes, and snippets.

@briancline
Last active October 29, 2022 07:05
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 briancline/cf39457961ca833643bc347227a66362 to your computer and use it in GitHub Desktop.
Save briancline/cf39457961ca833643bc347227a66362 to your computer and use it in GitHub Desktop.
Everyone please calm down with the gigantic fisher-price rounded corners on everything (especially you, Google)
_chill_factor = 0.25;
_chill_threshold = 5; // px
for (const el of document.querySelectorAll('*')) {
for (const _corner of ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft']) {
_prop = 'border' + _corner + 'Radius';
if (window.getComputedStyle(el)[_prop] !== '0px') {
_rad = parseInt(window.getComputedStyle(el)[_prop]);
if (isNaN(_rad) || _rad <= _chill_threshold) {
continue;
}
_vrad = Math.min(_chill_threshold, Math.floor(_rad * _chill_factor));
// console.log(_prop, _rad + 'px', _vrad + 'px', el);
el.style[_prop] = _vrad + 'px';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment