func IsHexColor(str string) bool {
	return regexp.MustCompile(PatternHexColor).MatchString(str)
}
IsHexColor check if the string is a hexadecimal color.
package vvalidator
import (
	"encoding/json"
	"net"
	"regexp"
	"strconv"
	"strings"
	"time"
	"unicode"
)
const (
	PatternNumeric = "^[0-9]+$"
	PatternInt = "^(?:[-+]?(?:0|[1-9][0-9]*))$"
	PatternFloat = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"
	PatternHexadecimal = "^[0-9a-fA-F]+$"
	PatternAlpha = "^[a-zA-Z]+$"
	PatternAlphanumeric = "^[a-zA-Z0-9]+$"
	PatternLatitude = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
	PatternLongitude = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
	PatternBase64 = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
	PatternASCII = "^[\x00-\x7F]+$"
	PatternPrintableASCII = "^[\x20-\x7E]+$"
	PatternIP = `(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))`
	PatternURLSchema = `((ftp|tcp|udp|wss?|https?):\/\/)`
	PatternURLUsername = `(\S+(:\S*)?@)`
	PatternURLPath = `((\/|\?|#)[^\s]*)`
	PatternURLPort = `(:(\d{1,5}))`
	PatternURLIP = `([1-9]\d?|1\d\d|2[01]\d|22[0-3])(\.(1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-4]))`
	PatternURLSubdomain = `((www\.)|([a-zA-Z0-9]([-\.][-\._a-zA-Z0-9]+)*))`
	PatternURL = `^` + PatternURLSchema + `?` + PatternURLUsername + `?` + `((` + PatternURLIP + `|(\[` + PatternIP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + PatternURLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + PatternURLPort + `?` + PatternURLPath + `?$`
	PatternEmail = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
	PatternWinPath = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
	PatternUnixPath = `^(/[^/\x00]*)+/?$`
	PatternSemver = "^v?(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$"
	PatternFullWidth = `[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]`
	PatternHalfWidth = `[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]`
	PatternHexColor = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
	PatternRGBColor = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$"
	PatternRGBAColor = "^rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0\\.[0-9]{1})|(1\\.0)|(1))\\)$"
)
func IsNumeric(str string) bool {
	return regexp.MustCompile(PatternNumeric).MatchString(str)
}
func IsInt(str string) bool {
	return regexp.MustCompile(PatternInt).MatchString(str)
}
func IsFloat(str string) bool {
	return regexp.MustCompile(PatternFloat).MatchString(str)
}
func IsHexadecimal(str string) bool {
	return regexp.MustCompile(PatternHexadecimal).MatchString(str)
}
func IsAlpha(str string) bool {
	return regexp.MustCompile(PatternAlpha).MatchString(str)
}
func IsAlphanumeric(str string) bool {
	return regexp.MustCompile(PatternAlphanumeric).MatchString(str)
}
func IsIP(str string) bool {
	return net.ParseIP(str) != nil
}
func IsIPv4(str string) bool {
	ip := net.ParseIP(str)
	if ip == nil {
		return false
	}
	return strings.Contains(str, ".")
}
func IsIPv6(str string) bool {
	ip := net.ParseIP(str)
	if ip == nil {
		return false
	}
	return strings.Contains(str, ":")
}
func IsLatitude(str string) bool {
	return regexp.MustCompile(PatternLatitude).MatchString(str)
}
func IsLongitude(str string) bool {
	return regexp.MustCompile(PatternLongitude).MatchString(str)
}
func IsBase64(str string) bool {
	return regexp.MustCompile(PatternBase64).MatchString(str)
}
func IsPort(str string) bool {
	if n, err := strconv.Atoi(str); err == nil && n > 0 && n < 65536 {
		return true
	}
	return false
}
func IsURL(str string) bool {
	return regexp.MustCompile(PatternURL).MatchString(str)
}
func IsASCII(str string) bool {
	return regexp.MustCompile(PatternASCII).MatchString(str)
}
func IsPrintableASCII(str string) bool {
	return regexp.MustCompile(PatternPrintableASCII).MatchString(str)
}
func IsEmail(str string) bool {
	return regexp.MustCompile(PatternEmail).MatchString(str)
}
func IsWinPath(str string) bool {
	if regexp.MustCompile(PatternWinPath).MatchString(str) {
		if len(str[3:]) > 32767 {
			return false
		}
		return true
	}
	return false
}
func IsUnixPath(str string) bool {
	return regexp.MustCompile(PatternUnixPath).MatchString(str)
}
func IsSemver(str string) bool {
	return regexp.MustCompile(PatternSemver).MatchString(str)
}
func IsFullWidth(str string) bool {
	return regexp.MustCompile(PatternFullWidth).MatchString(str)
}
func IsHalfWidth(str string) bool {
	return regexp.MustCompile(PatternHalfWidth).MatchString(str)
}
func IsHash(str, algorithm string) bool {
	length := "0"
	algo := strings.ToLower(algorithm)
	switch algo {
	case "crc32", "crc32b":
		length = "8"
	case "md5", "md4", "ripemd128", "tiger128":
		length = "32"
	case "sha1", "ripemd160", "tiger160":
		length = "40"
	case "tiger192":
		length = "48"
	case "sha256":
		length = "64"
	case "sha384":
		length = "96"
	case "sha512":
		length = "128"
	default:
		return false
	}
	return regexp.MustCompile("^[a-f0-9]{" + length + "}$").MatchString(str)
}
func IsMAC(str string) bool {
	_, err := net.ParseMAC(str)
	return err == nil
}
func IsTime(str string, format string) bool {
	_, err := time.Parse(format, str)
	return err == nil
}
func IsRFC3339Time(str string) bool {
	return IsTime(str, time.RFC3339)
}
func IsRFC3339WithoutZoneTime(str string) bool {
	return IsTime(str, "2006-01-02T15:04:05")
}
func IsJSON(str string) bool {
	var js json.RawMessage
	return json.Unmarshal([]byte(str), &js) == nil
}
func IsUTFLetter(str string) bool {
	for _, c := range str {
		if !unicode.IsLetter(c) {
			return false
		}
	}
	return true
}
func IsUTFLetterNumeric(str string) bool {
	for _, c := range str {
		if !unicode.IsLetter(c) && !unicode.IsNumber(c) {  
			return false
		}
	}
	return true
}