Skip to content

Instantly share code, notes, and snippets.

@briancline
Last active October 29, 2022 07:05
Embed
What would you like to do?
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