Commit 010b0989 authored by carl's avatar carl Committed by 杨奕

fix invalid hover color of nav menu when background color contains 0

parent 9f2ea7ea
...@@ -157,14 +157,14 @@ ...@@ -157,14 +157,14 @@
}, },
getColorChannels(color) { getColorChannels(color) {
color = color.replace('#', ''); color = color.replace('#', '');
if (/^[1-9a-fA-F]{3}$/.test(color)) { if (/^[0-9a-fA-F]{3}$/.test(color)) {
color = color.split(''); color = color.split('');
for (let i = 2; i >= 0; i--) { for (let i = 2; i >= 0; i--) {
color.splice(i, 0, color[i]); color.splice(i, 0, color[i]);
} }
color = color.join(''); color = color.join('');
} }
if (/^[1-9a-fA-F]{6}$/.test(color)) { if (/^[0-9a-fA-F]{6}$/.test(color)) {
return { return {
red: parseInt(color.slice(0, 2), 16), red: parseInt(color.slice(0, 2), 16),
green: parseInt(color.slice(2, 4), 16), green: parseInt(color.slice(2, 4), 16),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment