Dygmalab / Bazecor

Graphical configurator for Dygma Products
https://dygma.com/
GNU General Public License v3.0
403 stars 90 forks source link

fix: handle hex colors without a preceeding # and refactor #912

Closed lbrooks closed 1 month ago

lbrooks commented 1 month ago

Two edge cases for this two functions would result in NaN being contained within the returned color matrix:

  1. Supplying a hex color string without a preceeding #
  2. Supplying a string that was not in the hex or rgb color format.

This PR covers those two cases by:

  1. Supporting hex colors without a preceeding #
  2. Defaults to black if the input string is neither a hex or rgb color

Additionally this PR also