You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB

4 years ago
  1. 'use strict';
  2. const isRGB = require('./lib/isRGB');
  3. const isRGBA = require('./lib/isRGBA');
  4. const isHSL = require('./lib/isHSL');
  5. const isHSLA = require('./lib/isHSLA');
  6. const isHex = require('./lib/isHex');
  7. const isCSSColorName = require('./lib/isCSSColorName');
  8. const isTransparent = require('./lib/isTransparent');
  9. const isCSSLengthUnit = require('./lib/isCSSLengthUnit');
  10. const isStop = require('./lib/isStop');
  11. function isColor(colorStr) {
  12. const color =
  13. isRGB(colorStr) ||
  14. isRGBA(colorStr) ||
  15. isHSL(colorStr) ||
  16. isHSLA(colorStr) ||
  17. isHex(colorStr) ||
  18. isCSSColorName(colorStr) ||
  19. isTransparent(colorStr);
  20. return color;
  21. }
  22. module.exports = function isColorStop(color, stop) {
  23. return isColor(color) && isStop(stop);
  24. };
  25. module.exports.isColor = isColor;
  26. module.exports.isRGB = isRGB;
  27. module.exports.isRGBA = isRGBA;
  28. module.exports.isHSL = isHSL;
  29. module.exports.isHSLA = isHSLA;
  30. module.exports.isHex = isHex;
  31. module.exports.isCSSColorName = isCSSColorName;
  32. module.exports.isTransparent = isTransparent;
  33. module.exports.isCSSLengthUnit = isCSSLengthUnit;