You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: function randomColor returns array (#691)
* refactor: function randomColor and function getContrastingPair
Instead of returning string which will be subjected to number extract via regex we just return array of three numbers.
We use string interpolation inside function getContrastingPair when string is needed.
Change from while loop to for loop in function getContrastingPair.
This function has a potential to enter an infinite loop if it consistently fails to find a pair of colors with sufficient
contrast. This could freeze the user's browser. I'd suggest refactoring it to use a for loop with a maximum
number of attempts and a fallback to a default high-contrast pair. This makes the code more robust and also
simplifies the logic by removing the need for the valid flag. (gemini cost assist)
* Update frontend/assets/scripts/script.js
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
---------
Co-authored-by: John Bampton <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
0 commit comments