Last active
October 29, 2022 07:05
-
-
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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