Skip to content

Commit b9b595b

Browse files
authored
Merge pull request #7317 from nextcloud-libraries/fix/stable8-colorpicker
2 parents dabb5c0 + 3815b45 commit b9b595b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/NcColorPicker/NcColorPicker.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export default {
450450
*
451451
* @param {string} color the hex color
452452
*/
453-
calculateLuma(color) {
453+
calculateLuma(color) {
454454
const [red, green, blue] = this.hexToRGB(color)
455455
return (0.2126 * red + 0.7152 * green + 0.0722 * blue) / 255
456456
},
@@ -459,12 +459,13 @@ export default {
459459
* Convert hex color to RGB
460460
*
461461
* @param {string} hex the hex color
462+
* @return {[number, number, number]}
462463
*/
463-
hexToRGB(hex) {
464+
hexToRGB(hex) {
464465
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
465466
return result
466467
? [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)]
467-
: null
468+
: [0, 0, 0]
468469
},
469470
},
470471
}

0 commit comments

Comments
 (0)