mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-20 06:29:07 +00:00
Improve change api (#628)
* fix: jsdoc comments * more human casting of string values to boolean * add coerceColour to get named colors to work * cue can't pass isKeyOfType event check * dont mutate value * alloow cue in eventDef * lint * css named or hex formatting * "sideEffects": false * test colour hex regex * roll eventDef back to master * parse property * don't export cssColour names * remove import * only allow string types to colour * handle transparent colour * mix alpha with bg colour * only allow updating events * descriptive names * add test for getAccessibleColour * readability * move isColourHex to regex-utils * simplify and add test
This commit is contained in:
committed by
GitHub
parent
a93cd3e9b1
commit
1343818917
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @description Validates a colour hex string
|
||||
* @param {string} text - colour hex string "#FFF" | "#FFFF" | "#FFFFFF" | "#FFFFFFFF"
|
||||
* @returns {boolean} string represents time
|
||||
*/
|
||||
export const isColourHex = (text: string): boolean => {
|
||||
const regexS = /^#((?:[a-f\d]{1}){3,4})$/i;
|
||||
const regexD = /^#((?:[a-f\d]{2}){3,4})$/i;
|
||||
return regexS.test(text) || regexD.test(text);
|
||||
};
|
||||
Reference in New Issue
Block a user