mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
refactor: move hex color validation to theme types
This commit is contained in:
parent
1fe6abb241
commit
a42975a71f
@ -32,8 +32,3 @@ export const isPortableVersion = () => {
|
||||
|
||||
export const normalizePath = (str: string) =>
|
||||
path.posix.normalize(str).replace(/\\/g, "/");
|
||||
|
||||
export const isValidHexColor = (color: string): boolean => {
|
||||
const hexColorRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
||||
return hexColorRegex.test(color);
|
||||
};
|
||||
|
@ -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>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user