refactor: move hex color validation to theme types

This commit is contained in:
Hachi-R 2025-01-29 03:52:54 -03:00
parent 1fe6abb241
commit a42975a71f
2 changed files with 5 additions and 6 deletions

View file

@ -1,6 +1,10 @@
import { isValidHexColor } from "@main/helpers";
import { z } from "zod";
const isValidHexColor = (color: string): boolean => {
const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
return hexColorRegex.test(color);
};
const hexColorSchema = z.string().refine(isValidHexColor);
type HexColorType = z.infer<typeof hexColorSchema>;