frontend/.pnpm-store/v3/files/d6/4733aa3b297e13bc6836e5559db557440d42df2ab62dcd9ff76c4ba458e78127b7a880fbd66aed12258964241b5b48eddff082206a0d1a624f40fa485a9d39

15 lines
844 B
Plaintext

import assertString from './util/assertString';
var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/;
var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/;
var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/;
export default function isRgbColor(str) {
var includePercentValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
assertString(str);
if (!includePercentValues) {
return rgbColor.test(str) || rgbaColor.test(str);
}
return rgbColor.test(str) || rgbaColor.test(str) || rgbColorPercent.test(str) || rgbaColorPercent.test(str);
}