colors: Reuse the HexDigits constant in strutils (#16065)

Co-authored-by: Xuecong Liao <xliao@flexport.com>
This commit is contained in:
satoru
2020-11-20 17:55:14 +08:00
committed by GitHub
parent 7815ed69d4
commit 81a03238ed

View File

@@ -475,7 +475,7 @@ proc isColor*(name: string): bool =
if name.len == 0: return false
if name[0] == '#':
for i in 1 .. name.len-1:
if name[i] notin {'0'..'9', 'a'..'f', 'A'..'F'}: return false
if name[i] notin HexDigits: return false
result = true
else:
result = binarySearch(colorNames, name, colorNameCmp) >= 0