53f02eda05b1d2e0c2e677d52a6bad00210732bf1847b26941c8bbc7eacab1f87a917f8852b8007b23a8f6bb82c3e39150ea5fcc2aeb3e7e92d256d2ebb241 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import type { RgbValue, RgbaValue } from './types/index';
  2. /**
  3. * @description Test if a hex color
  4. * @param {string} color color string
  5. * @return {boolean} Test result
  6. */
  7. export declare function isHex(color: string): boolean;
  8. /**
  9. * @description Test if a rgb color
  10. * @param {string} color color string
  11. * @return {boolean} Test result
  12. */
  13. export declare function isRgb(color: string): boolean;
  14. /**
  15. * @description Test if a rgba color
  16. * @param {string} color color string
  17. * @return {boolean} Test result
  18. */
  19. export declare function isRgba(color: string): boolean;
  20. /**
  21. * @description Test if a rgb or rgba color
  22. * @param {string} color color string
  23. * @return {boolean} Test result
  24. */
  25. export declare function isRgbOrRgba(color: string): boolean;
  26. /**
  27. * @description Get the Rgb value of the color
  28. * @param {string} color Hex|Rgb|Rgba color or color keyword
  29. * @return {RgbValue} Rgb value of the color
  30. */
  31. export declare function getRgbValue(color: string): RgbValue;
  32. /**
  33. * @description Get the opacity of color
  34. * @param {string} color Hex|Rgb|Rgba color or color keyword
  35. * @return {number} Color opacity
  36. */
  37. export declare function getOpacity(color: string): number;
  38. /**
  39. * @description Get the Rgba value of the color
  40. * @param {string} color Hex|Rgb|Rgba color or color keyword
  41. * @return {RgbaValue} Rgba value of the color
  42. */
  43. export declare function getRgbaValue(color: string): RgbaValue;
  44. /**
  45. * @description Convert color to Rgb|Rgba color
  46. * @param {string} color Hex|Rgb|Rgba color or color keyword
  47. * @param {number} opacity The opacity of color
  48. * @return {string} Rgb|Rgba color
  49. */
  50. export declare function toRgb(color: string, opacity?: number): string;
  51. /**
  52. * @description Convert color to Hex color
  53. * @param {string} color Hex|Rgb|Rgba color or color keyword
  54. * @return {string} Hex color
  55. */
  56. export declare function toHex(color: string): string;
  57. /**
  58. * @description Get Color from Rgb|Rgba value
  59. * @param {RgbValue|RgbaValue} value Rgb|Rgba color value
  60. * @return {string} Rgb|Rgba color
  61. */
  62. export declare function getColorFromRgbValue(value: RgbValue | RgbaValue): string;
  63. /**
  64. * @description Deepen color
  65. * @param {string} color Hex|Rgb|Rgba color or color keyword
  66. * @param {number} percent of Deepen (1-100)
  67. * @return {string} Rgba color
  68. */
  69. export declare function darken(color: string, percent?: number): string;
  70. /**
  71. * @description Brighten color
  72. * @param {string} color Hex|Rgb|Rgba color or color keyword
  73. * @param {number} percent of brighten (1-100)
  74. * @return {string} Rgba color
  75. */
  76. export declare function lighten(color: string, percent?: number): string;
  77. /**
  78. * @description Adjust color opacity
  79. * @param {string} color Hex|Rgb|Rgba color or color keyword
  80. * @param {number} percent of opacity
  81. * @return {string} Rgba color
  82. */
  83. export declare function fade(color: string, percent?: number): string;