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
commit 81a03238ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -475,7 +475,7 @@ proc isColor*(name: string): bool =
if name.len == 0: return false if name.len == 0: return false
if name[0] == '#': if name[0] == '#':
for i in 1 .. name.len-1: 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 result = true
else: else:
result = binarySearch(colorNames, name, colorNameCmp) >= 0 result = binarySearch(colorNames, name, colorNameCmp) >= 0