Skip to content

Commit

Permalink
fix: add random colors, when colorArray is too small (#1688)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteyou authored Dec 16, 2023
1 parent ac698b7 commit eb7773d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/store/printer/tempHistory/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export const actions: ActionTree<PrinterTempHistoryState, RootState> = {
if (!color) {
color = colorArray[colorNumber]
colorNumber++

// fallback -> get random color
if (color === undefined) {
// color generator from https://css-tricks.com/snippets/javascript/random-hex-color/
color = '#' + Math.floor(0xffffff * Math.random()).toString(16)
}
}
}

Expand Down

0 comments on commit eb7773d

Please sign in to comment.