We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 115813e commit 9ed3c36Copy full SHA for 9ed3c36
site/src/utils/colors.ts
@@ -1,8 +1,15 @@
1
/**
2
- * Does not support shorthand hex string (e.g., #fff)
+ * Does not support shorthand hex strings (e.g., #fff), just to maximize
3
+ * compatibility with server, which also doesn't support shorthand
4
*/
5
const hexMatcher = /^#[0-9A-Fa-f]{6}$/;
6
7
+/**
8
+ * Determines whether a string is a hex color string. Returns false for
9
+ * shorthand hex strings.
10
+ *
11
+ * Mainly here to validate input before sending it to the server.
12
+ */
13
export function isHexColor(input: string): boolean {
14
return hexMatcher.test(input);
15
}
0 commit comments