color-util-helpers 1.0.7 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/color-util-helpers-1.0.10.tgz +0 -0
- package/esm2022/color-util-helpers.mjs +5 -0
- package/esm2022/lib/color-conversion.service.mjs +39 -0
- package/esm2022/lib/color-extractor.directive.mjs +37 -0
- package/esm2022/lib/color-grab.directive.mjs +185 -0
- package/esm2022/lib/color-lighten-darken.service.mjs +79 -0
- package/esm2022/lib/color-pallette.service.mjs +172 -0
- package/esm2022/lib/color-scheme.service.mjs +113 -0
- package/esm2022/lib/color-utilities-demo/color-utilities-demo.component.mjs +41 -0
- package/esm2022/lib/color-utils.module.mjs +38 -0
- package/esm2022/lib/text-color.service.mjs +79 -0
- package/esm2022/public-api.mjs +13 -0
- package/fesm2022/color-util-helpers.mjs +767 -0
- package/fesm2022/color-util-helpers.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/color-conversion.service.d.ts +8 -0
- package/lib/color-extractor.directive.d.ts +13 -0
- package/lib/color-grab.directive.d.ts +31 -0
- package/lib/color-lighten-darken.service.d.ts +10 -0
- package/lib/color-pallette.service.d.ts +36 -0
- package/lib/color-scheme.service.d.ts +45 -0
- package/lib/color-utilities-demo/color-utilities-demo.component.d.ts +34 -0
- package/lib/color-utils.module.d.ts +12 -0
- package/lib/text-color.service.d.ts +18 -0
- package/package.json +15 -2
- package/{src/public-api.ts → public-api.d.ts} +0 -6
- package/ng-package.json +0 -8
- package/src/lib/assets/picture.webp +0 -0
- package/src/lib/color-conversion.service.spec.ts +0 -54
- package/src/lib/color-conversion.service.ts +0 -35
- package/src/lib/color-extractor.directive.spec.ts +0 -49
- package/src/lib/color-extractor.directive.ts +0 -28
- package/src/lib/color-grab.directive.ts +0 -204
- package/src/lib/color-lighten-darken.service.spec.ts +0 -61
- package/src/lib/color-lighten-darken.service.ts +0 -83
- package/src/lib/color-pallette.service.spec.ts +0 -85
- package/src/lib/color-pallette.service.ts +0 -191
- package/src/lib/color-scheme.service.ts +0 -123
- package/src/lib/color-utilities-demo/color-utilities-demo.component.css +0 -12
- package/src/lib/color-utilities-demo/color-utilities-demo.component.html +0 -109
- package/src/lib/color-utilities-demo/color-utilities-demo.component.ts +0 -57
- package/src/lib/color-utils.module.ts +0 -27
- package/src/lib/text-color.service.spec.ts +0 -75
- package/src/lib/text-color.service.ts +0 -101
- package/tsconfig.lib.json +0 -32
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-util-helpers.mjs","sources":["../../../projects/color-util-helpers/src/lib/color-grab.directive.ts","../../../projects/color-util-helpers/src/lib/color-conversion.service.ts","../../../projects/color-util-helpers/src/lib/color-pallette.service.ts","../../../projects/color-util-helpers/src/lib/text-color.service.ts","../../../projects/color-util-helpers/src/lib/color-lighten-darken.service.ts","../../../projects/color-util-helpers/src/lib/color-scheme.service.ts","../../../projects/color-util-helpers/src/lib/color-utilities-demo/color-utilities-demo.component.ts","../../../projects/color-util-helpers/src/lib/color-utilities-demo/color-utilities-demo.component.html","../../../projects/color-util-helpers/src/lib/color-extractor.directive.ts","../../../projects/color-util-helpers/src/lib/color-utils.module.ts","../../../projects/color-util-helpers/src/public-api.ts","../../../projects/color-util-helpers/src/color-util-helpers.ts"],"sourcesContent":["import { Directive, ElementRef, Input, OnInit } from '@angular/core';\n\n@Directive({\n selector: '[colorGrabber]'\n})\nexport class ColorGrabberDirective implements OnInit {\n\n ctx?: CanvasRenderingContext2D\n\n @Input() imageUrl?: string\n @Input() light?: string\n @Input() dark?: string\n\n constructor(private el: ElementRef) { }\n\n ngOnInit() {\n\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n\n this.ctx = canvas.getContext('2d') as CanvasRenderingContext2D;\n\n const img = new Image();\n img.src = this.imageUrl || '';\n img.setAttribute('crossOrigin', '');\n\n img.onload = () => {\n this.ctx?.drawImage(img, 0, 0, 1, 1);\n const imageData = this.ctx?.getImageData(0, 0, 1, 1);\n\n if (imageData && imageData.data) {\n const i = imageData.data;\n\n const rgbColor = `rgba(${i[0]},${i[1]},${i[2]},${i[3]})`;\n const hexColor = \"#\" + ((1 << 24) + (i[0] << 16) + (i[1] << 8) + i[2]).toString(16).slice(1);\n\n const textColor = this.textColorBasedOnBgColor(hexColor, this.light, this.dark);\n\n const hsv = this.RGB2HSV({ r: i[0], g: i[1], b: i[2] });\n hsv.hue = this.HueShift(hsv.hue, 135.0);\n\n const secondaryColor = this.HSV2RGB(hsv);\n const highlightColor = this.lightenDarkenColor(secondaryColor.hex, 50);\n\n this.el.nativeElement.style.backgroundColor = rgbColor;\n this.el.nativeElement.style.color = textColor;\n } else {\n console.error(\"Failed to get image data.\");\n }\n };\n }\n\n textColorBasedOnBgColor(\n bgColor: string,\n lightColor: string = '#FFFFFF',\n darkColor: string = '#000000'\n ) {\n\n const color = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor\n\n const r = parseInt(color.substring(0, 2), 16) // hexToR\n const g = parseInt(color.substring(2, 4), 16) // hexToG\n const b = parseInt(color.substring(4, 6), 16) // hexToB\n\n const uicolors = [r / 255, g / 255, b / 255]\n\n const c = uicolors.map((col) => {\n\n if (col <= 0.03928) return col / 12.92\n return Math.pow((col + 0.055) / 1.055, 2.4)\n\n })\n\n const L = (0.2126 * c[0]) + (0.7152 * c[1]) + (0.0722 * c[2])\n\n return (L > 0.179) ? darkColor : lightColor\n\n }\n\n RGB2HSV(rgb: { r: any, g: any, b: any}) {\n\n const hsv = { saturation:0, hue:0, value: 0 }\n\n const max = this.max3(rgb.r,rgb.g,rgb.b)\n const dif = max - this.min3(rgb.r,rgb.g,rgb.b)\n hsv.saturation = (max==0.0)?0:(100*dif/max)\n\n if (hsv.saturation == 0) {\n hsv.hue=0\n } else if (rgb.r == max) {\n hsv.hue=60.0*(rgb.g-rgb.b)/dif\n } else if (rgb.g == max) {\n hsv.hue=120.0+60.0*(rgb.b-rgb.r)/dif\n } else if (rgb.b == max) {\n hsv.hue=240.0+60.0*(rgb.r-rgb.g)/dif\n }\n\n if (hsv.hue<0.0) hsv.hue+=360.0\n\n hsv.value = Math.round(max*100/255)\n hsv.hue = Math.round(hsv.hue)\n hsv.saturation = Math.round(hsv.saturation)\n\n return hsv\n }\n\n HSV2RGB(hsv: any) {\n\n const rgb = { r: 0, g: 0, b: 0}\n\n if (hsv.saturation==0) {\n rgb.r = rgb.g = rgb.b = Math.round(hsv.value*2.55)\n } else {\n\n hsv.hue/=60\n hsv.saturation/=100\n hsv.value/=100\n const i = Math.floor(hsv.hue)\n const f = hsv.hue-i\n\n const p = hsv.value*(1-hsv.saturation)\n const q = hsv.value*(1-hsv.saturation*f)\n const t = hsv.value*(1-hsv.saturation*(1-f))\n\n switch(i) {\n\n case 0: rgb.r=hsv.value; rgb.g=t; rgb.b=p; break\n case 1: rgb.r=q; rgb.g=hsv.value; rgb.b=p; break\n case 2: rgb.r=p; rgb.g=hsv.value; rgb.b=t; break\n case 3: rgb.r=p; rgb.g=q; rgb.b=hsv.value; break\n case 4: rgb.r=t; rgb.g=p; rgb.b=hsv.value; break\n\n default: rgb.r=hsv.value; rgb.g=p; rgb.b=q\n\n }\n\n rgb.r = Math.round(rgb.r*255)\n rgb.g = Math.round(rgb.g*255)\n rgb.b = Math.round(rgb.b*255)\n\n }\n\n const rgbColor = `rgba(${rgb.r},${rgb.g},${rgb.b},${1})`\n const hexColor = \"#\" + ((1 << 24) + (rgb.r << 16) + (rgb.g << 8) + rgb.b).toString(16).slice(1)\n\n return { rgb: rgbColor, hex: hexColor }\n }\n\n HueShift(h: any, s: any) {\n h += s\n while (h>=360.0) h-=360.0\n while (h<0.0) h+=360.0\n return h\n }\n\n min3(a: any, b: any, c: any) {\n return (a<b)?((a<c)?a:c):((b<c)?b:c)\n }\n\n max3(a: any, b: any, c: any) {\n return (a>b)?((a>c)?a:c):((b>c)?b:c)\n }\n\n lightenDarkenColor(colorCode: any, amount: number) {\n\n var usePound = false;\n\n if (colorCode[0] == \"#\") {\n colorCode = colorCode.slice(1);\n usePound = true;\n }\n\n var num = parseInt(colorCode, 16);\n\n var r = (num >> 16) + amount;\n\n if (r > 255) {\n r = 255;\n } else if (r < 0) {\n r = 0;\n }\n\n var b = ((num >> 8) & 0x00FF) + amount;\n\n if (b > 255) {\n b = 255;\n } else if (b < 0) {\n b = 0;\n }\n\n var g = (num & 0x0000FF) + amount;\n\n if (g > 255) {\n g = 255;\n } else if (g < 0) {\n g = 0;\n }\n\n return (usePound ? \"#\" : \"\") + (g | (b << 8) | (r << 16)).toString(16)\n\n }\n\n}\n","import { Injectable } from '@angular/core';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ColorConversionService {\r\n\r\n rgbToHex(rgb: number[] | null): string {\r\n if (rgb === null || rgb.length !== 3 || rgb.some(value => value < 0 || value > 255)) return '';\r\n\r\n const [r, g, b] = rgb;\r\n const hexR = this.componentToHex(r);\r\n const hexG = this.componentToHex(g);\r\n const hexB = this.componentToHex(b);\r\n return \"#\" + hexR + hexG + hexB;\r\n }\r\n\r\n private componentToHex = (c: number) => {\r\n const hex = c.toString(16);\r\n return hex.length === 1 ? \"0\" + hex : hex;\r\n }\r\n\r\n hexToRgb(hex: string | null | undefined): number[] {\r\n if (hex === null || hex === undefined) return [];\r\n\r\n hex = (hex.length === 3) ? hex + hex : hex;\r\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\r\n\r\n return result ? [\r\n parseInt(result[1], 16),\r\n parseInt(result[2], 16),\r\n parseInt(result[3], 16)\r\n ] : [];\r\n }\r\n}\r\n","import { Injectable } from '@angular/core'\r\nimport { BehaviorSubject } from 'rxjs'\r\nimport { ColorConversionService } from './color-conversion.service'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class ColorPalletteService {\r\n\r\n // define image path\r\n // this.colorSelectionService.getColorsFromImage('../assets/sample2.jpg')\r\n\r\n // get colors\r\n // this.colorSelectionService.palette.subscribe(data => this.palette = data)\r\n\r\n // sample html\r\n // <div *ngFor=\"let color of palette\">\r\n // <div style=\"display: flex;\">\r\n // <div\r\n // class=\"box\"\r\n // [style.background-color]=\"color.color\"\r\n // >\r\n // Color\r\n // </div>\r\n // <div\r\n // class=\"box\"\r\n // [style.background-color]=\"color.complementaryColor\"\r\n // >\r\n // Complementary\r\n // </div>\r\n // </div>\r\n // </div>\r\n\r\n // CSS\r\n // .box {\r\n // width: 100px;\r\n // height: 100px;\r\n // border: solid thin black;\r\n // color: black;\r\n // margin: 4px;\r\n // padding: 16px;\r\n // display: flex;\r\n // flex-wrap: wrap;\r\n // align-content: center;\r\n // justify-content: center;\r\n // }\r\n\r\n private palette = new BehaviorSubject<{ color: string, complementaryColor: string }[]>([])\r\n palette$ = this.palette.asObservable()\r\n\r\n constructor(\r\n private colorConversionService: ColorConversionService\r\n ) { }\r\n\r\n /**\r\n * Retrieves a color palette from an image at the specified path.\r\n *\r\n * @param imagePath - The path to the image to extract the color palette from.\r\n * @param colors - The number of colors to include in the palette (default is 3).\r\n * @returns An observable that emits the generated color palette.\r\n */\r\n getColorsFromImage(imagePath: string, colors = 3) {\r\n const image = new Image();\r\n image.src = imagePath;\r\n\r\n image.onload = () => {\r\n const data = this.generateColorPalette(image, colors) || [];\r\n this.palette.next(data);\r\n };\r\n }\r\n\r\n /**\r\n * Generates a color palette from an image.\r\n *\r\n * @param image - The HTML image element to extract the color palette from.\r\n * @param colorCount - The number of colors to include in the palette (default is 6).\r\n * @returns An array of color objects, each with a hex color and a complementary hex color.\r\n */\r\n generateColorPalette(image: HTMLImageElement, colorCount = 6) {\r\n const canvas = document.createElement(\"canvas\");\r\n const context = canvas.getContext(\"2d\");\r\n\r\n if (!context) return;\r\n\r\n canvas.width = image.width;\r\n canvas.height = image.height;\r\n context.drawImage(image, 0, 0);\r\n\r\n // Get the image data\r\n const imageData = context.getImageData(0, 0, canvas.width, canvas.height);\r\n const pixels = imageData.data;\r\n const pixelCount = imageData.width * imageData.height;\r\n\r\n // Build an array of RGB colors\r\n const colors = [];\r\n for (let i = 0; i < pixelCount; i++) {\r\n const offset = i * 4;\r\n const r = pixels[offset];\r\n const g = pixels[offset + 1];\r\n const b = pixels[offset + 2];\r\n colors.push([r, g, b]);\r\n }\r\n\r\n // Apply color quantization using k-means clustering\r\n const quantizedColors = this.kMeansColorQuantization(colors, colorCount);\r\n\r\n // Order colors by luminance\r\n quantizedColors.sort((color1, color2) => {\r\n const luminance1 = this.getLuminance(color1);\r\n const luminance2 = this.getLuminance(color2);\r\n return luminance2 - luminance1;\r\n });\r\n\r\n const palette = quantizedColors.map((color) => {\r\n const complementaryColor = color.map((component) => 255 - component);\r\n const hexColor = this.colorConversionService.rgbToHex(color);\r\n const hexComplementaryColor =\r\n this.colorConversionService.rgbToHex(complementaryColor);\r\n return { color: hexColor, complementaryColor: hexComplementaryColor };\r\n });\r\n\r\n return palette;\r\n }\r\n\r\n private getLuminance(color: number[]) {\r\n const [r, g, b] = color\r\n return 0.299 * r + 0.587 * g + 0.114 * b\r\n }\r\n\r\n private calculateColorDistance(color1: number[], color2: number[]) {\r\n const [r1, g1, b1] = color1\r\n const [r2, g2, b2] = color2\r\n const dr = r2 - r1\r\n const dg = g2 - g1\r\n const db = b2 - b1\r\n return Math.sqrt(dr * dr + dg * dg + db * db)\r\n }\r\n\r\n private calculateMeanColor(colors: number[][]) {\r\n let sumR = 0\r\n let sumG = 0\r\n let sumB = 0\r\n for (let i = 0; i < colors.length; i++) {\r\n const [r, g, b] = colors[i]\r\n sumR += r\r\n sumG += g\r\n sumB += b\r\n }\r\n const meanR = Math.round(sumR / colors.length)\r\n const meanG = Math.round(sumG / colors.length)\r\n const meanB = Math.round(sumB / colors.length)\r\n return [meanR, meanG, meanB]\r\n }\r\n\r\n private kMeansColorQuantization(colors: number[][], k: number) {\r\n let clusterCenters = []\r\n for (let i = 0; i < k; i++) {\r\n const randomColor = colors[Math.floor(Math.random() * colors.length)]\r\n clusterCenters.push(randomColor)\r\n }\r\n\r\n let clusters = []\r\n for (let i = 0; i < colors.length; i++) {\r\n const color = colors[i]\r\n let minDistance = Infinity\r\n let nearestCenter = null\r\n for (let j = 0; j < clusterCenters.length; j++) {\r\n const center = clusterCenters[j]\r\n const distance = this.calculateColorDistance(color, center)\r\n if (distance < minDistance) {\r\n minDistance = distance\r\n nearestCenter = center\r\n }\r\n }\r\n clusters.push({ color, center: nearestCenter })\r\n }\r\n\r\n let updatedCenters = []\r\n for (let i = 0; i < clusterCenters.length; i++) {\r\n const center = clusterCenters[i]\r\n const clusterColors = clusters.filter(c => c.center === center).map(c => c.color)\r\n if (clusterColors.length > 0) {\r\n const updatedCenter = this.calculateMeanColor(clusterColors)\r\n updatedCenters.push(updatedCenter)\r\n }\r\n }\r\n\r\n return updatedCenters\r\n }\r\n\r\n}\r\n","import { Injectable } from '@angular/core'\r\nimport { ColorConversionService } from './color-conversion.service'\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class TextColorService {\r\n\r\n constructor(\r\n private colorConversionService: ColorConversionService\r\n ) {}\r\n\r\n textColorForBgColor(bgColor: string, lightColor: string, darkColor: string) {\r\n\r\n const UIColors = this.fixColor(bgColor)\r\n\r\n const r = UIColors[0]\r\n const g = UIColors[1]\r\n const b = UIColors[2]\r\n\r\n return ((r*0.299 + g*0.587 + b*0.114) > 149) ? darkColor : lightColor;\r\n\r\n }\r\n\r\n darkerColor(color1: string, color2: string) {\r\n return this.isColorDarker(color1, color2) ? color1 : color2;\r\n }\r\n\r\n isColorDarker(color1: string, color2: string) {\r\n\r\n const newColor1 = this.fixColor(color1);\r\n const newColor2 = this.fixColor(color2);\r\n\r\n const luminance1 = this.calculateLuminance(newColor1[0], newColor1[1], newColor1[2]);\r\n const luminance2 = this.calculateLuminance(newColor2[0], newColor2[1], newColor2[2]);\r\n\r\n return luminance1 < luminance2;\r\n }\r\n\r\n\r\n lighterColor(color1: string, color2: string): string {\r\n return (this.isColorLighter(color1,color2)) ? color1 : color2;\r\n }\r\n\r\n isColorLighter(color1: string, color2: string) {\r\n\r\n const newColor1 = this.fixColor(color1);\r\n const newColor2 = this.fixColor(color2);\r\n\r\n const luminance1 = this.calculateLuminance(newColor1[0], newColor1[1], newColor1[2]);\r\n const luminance2 = this.calculateLuminance(newColor2[0], newColor2[1], newColor2[2]);\r\n\r\n return (luminance1 > luminance2)\r\n\r\n }\r\n\r\n calculateLuminance(r: number, g: number, b: number): number {\r\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\r\n }\r\n\r\n fixColor(color: string) {\r\n // Remove leading hash if present\r\n const sanitizedColor = color.startsWith('#') ? color.slice(1) : color;\r\n\r\n // Validate if the color is a valid hex (3 or 6 characters)\r\n if (!this.isValidHex(sanitizedColor)) {\r\n return this.parseRgb(sanitizedColor); // If not hex, attempt to parse as RGB\r\n }\r\n\r\n // Convert hex to RGB\r\n const rgb = this.hexToRgb(sanitizedColor);\r\n return rgb;\r\n }\r\n\r\n // Helper function to validate if a string is a valid 3 or 6 digit hex code\r\n isValidHex(color: string): boolean {\r\n const hexRegex = /^[A-Fa-f0-9]{3}$|^[A-Fa-f0-9]{6}$/i;\r\n return hexRegex.test(color);\r\n }\r\n\r\n // Helper function to convert a 3 or 6 digit hex color to RGB\r\n hexToRgb(hex: string): number[] {\r\n if (hex.length === 3) {\r\n hex = hex.split('').map(c => c + c).join(''); // Expand shorthand hex to full\r\n }\r\n\r\n return [\r\n parseInt(hex.slice(0, 2), 16),\r\n parseInt(hex.slice(2, 4), 16),\r\n parseInt(hex.slice(4, 6), 16),\r\n ];\r\n }\r\n\r\n // Helper function to parse an RGB string (e.g., rgb(255, 0, 0)) into an array\r\n parseRgb(rgb: string): number[] {\r\n const match = rgb.match(/\\d+/g);\r\n return match ? match.map(num => parseInt(num)) : [];\r\n }\r\n\r\n\r\n}\r\n","import { Injectable, inject } from '@angular/core';\nimport { TextColorService } from './text-color.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ColorLightenDarkenService {\n\n colors = inject(TextColorService)\n\n // const color = '#3498db'; // Your color\n // const lighterColor = lighten(color, 0.2); // 20% lighter\n // const darkerColor = darken(color, 0.2); // 20% darker\n\n // console.log(lighterColor, darkerColor);\n\nconstructor() { }\n\n lighten(color: string, amount: number) {\n\n const rgb = this.colors.fixColor(color)\n // const rgb = color.match(/\\w\\w/g)?.map((x) => parseInt(x, 16)) || [];\n\n // Convert RGB to HSL\n let [r, g, b] = rgb.map((c) => c / 255);\n const max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n let h = 0,\n s = 0,\n l = (max + min) / 2;\n\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n\n // Modify the lightness and clamp it to [0, 1]\n l = Math.min(1, l + amount);\n\n // Convert HSL back to RGB\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n const hue2rgb = (p: number, q: number, t: number) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n // Convert RGB back to hexadecimal color\n const toHex = (x: number) =>\n Math.round(x * 255)\n .toString(16)\n .padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n\n darken(color: string, amount: number) {\n return this.lighten(color, -amount);\n }\n\n}\n","import { Injectable } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ColorSchemeService {\n\n constructor() { }\n\n /**\n * Generates a random hexadecimal color code.\n *\n * This function generates a random hue value between 0 and 360 degrees, and random saturation and lightness values between 50% and 100%. It then converts the HSL values to RGB values using the `hslToRgb` function, and finally converts the RGB values to a hexadecimal color code using the `rgbToHex` function.\n *\n * @returns A hexadecimal color code in the format \"#RRGGBB\".\n */\n generateRandomColor() {\n // Generate a random hue between 0 and 360 (representing degrees on the color wheel)\n const hue = Math.floor(Math.random() * 360);\n\n // Generate random saturation and lightness values between 50% and 100%\n const saturation = Math.floor(Math.random() * 51) + 50;\n const lightness = Math.floor(Math.random() * 51) + 50;\n\n // Convert HSL values to RGB values\n const rgbColor = this.hslToRgb(hue, saturation, lightness);\n\n // Convert RGB values to hexadecimal color code\n const hexColor = this.rgbToHex(rgbColor.r, rgbColor.g, rgbColor.b);\n\n return hexColor;\n }\n\n /**\n * Converts HSL (Hue, Saturation, Lightness) color values to RGB (Red, Green, Blue) color values.\n *\n * @param h - The hue value, ranging from 0 to 360 degrees.\n * @param s - The saturation value, ranging from 0 to 100 percent.\n * @param l - The lightness value, ranging from 0 to 100 percent.\n * @returns An object with the RGB color values, where each value is between 0 and 255.\n */\n hslToRgb(h: number, s: number, l: number) {\n h /= 360;\n s /= 100;\n l /= 100;\n\n let r, g, b;\n\n if (s === 0) {\n r = g = b = l; // Achromatic color (gray)\n } else {\n const hueToRgb = (p: number, q: number, t: number) => {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n };\n\n const q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n const p = 2 * l - q;\n\n r = Math.round(hueToRgb(p, q, h + 1 / 3) * 255);\n g = Math.round(hueToRgb(p, q, h) * 255);\n b = Math.round(hueToRgb(p, q, h - 1 / 3) * 255);\n }\n\n return { r, g, b };\n }\n\n /**\n * Converts RGB color values to a hexadecimal color string.\n *\n * @param r - The red color value, between 0 and 255.\n * @param g - The green color value, between 0 and 255.\n * @param b - The blue color value, between 0 and 255.\n * @returns A hexadecimal color string in the format \"#RRGGBB\".\n */\n rgbToHex(r: number, g: number, b: number) {\n const componentToHex = (c: number) => {\n const hex = c.toString(16);\n return hex.length === 1 ? \"0\" + hex : hex;\n };\n\n return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n }\n\n /**\n * Adjusts a hexadecimal color value by a given percentage.\n *\n * @param hexColor - The hexadecimal color value to adjust.\n * @param percentage - The percentage to adjust the color by, ranging from -100 to 100.\n * @returns The adjusted hexadecimal color value.\n */\n adjustHexColor(hexColor: string, percentage: number) {\n // Remove the \"#\" symbol if present\n hexColor = hexColor.replace(\"#\", \"\");\n\n // Convert the hex color to RGB values\n const red = parseInt(hexColor.substring(0, 2), 16);\n const green = parseInt(hexColor.substring(2, 4), 16);\n const blue = parseInt(hexColor.substring(4, 6), 16);\n\n // Calculate the adjustment amount based on the percentage\n const adjustAmount = Math.round(255 * (percentage / 100));\n\n // Adjust the RGB values\n const adjustedRed = this.clamp(red + adjustAmount);\n const adjustedGreen = this.clamp(green + adjustAmount);\n const adjustedBlue = this.clamp(blue + adjustAmount);\n\n // Convert the adjusted RGB values back to hex\n const adjustedHexColor = `#${(adjustedRed).toString(16).padStart(2, '0')}${(adjustedGreen).toString(16).padStart(2, '0')}${(adjustedBlue).toString(16).padStart(2, '0')}`;\n\n return adjustedHexColor;\n }\n\n clamp(value: number) {\n return Math.max(0, Math.min(value, 255));\n }\n\n}\n","import { Component, OnInit, inject } from '@angular/core';\n\nimport { ColorConversionService } from '../color-conversion.service';\nimport { ColorPalletteService } from '../color-pallette.service';\nimport { TextColorService } from '../text-color.service';\nimport { ColorLightenDarkenService } from '../color-lighten-darken.service';\nimport { ColorSchemeService } from '../color-scheme.service';\n\n@Component({\n selector: 'app-color-utilities-demo',\n templateUrl: './color-utilities-demo.component.html',\n styleUrls: ['./color-utilities-demo.component.css'],\n})\nexport class ColorUtilitiesDemoComponent implements OnInit {\n\n colorConversionService = inject(ColorConversionService)\n colorLightenDarkenService = inject(ColorLightenDarkenService)\n colorPalletteService = inject(ColorPalletteService)\n textColorService = inject(TextColorService)\n colorSchemeService = inject(ColorSchemeService)\n\n\n HEX = this.colorConversionService.rgbToHex([12, 56, 128])\n RGB = `rgb(${this.colorConversionService.hexToRgb('#AA11BB')})`\n\n\n lighten = this.colorLightenDarkenService.lighten('#AA11BB', .25)\n darken = this.colorLightenDarkenService.darken('#AA11BB', .25)\n\n colorIsDarker = this.textColorService.isColorDarker(this.lighten, this.darken)\n\n darkBk = this.textColorService.textColorForBgColor(this.HEX, this.lighten, this.darken)\n lightBk = this.textColorService.textColorForBgColor('whitesmoke', this.lighten, this.darken)\n\n palette: any\n colors$ = this.colorPalletteService.palette$\n\n colorPick = this.colorSchemeService.generateRandomColor()\n colorPickDarker = this.colorSchemeService.adjustHexColor(this.colorPick, -25)\n colorPickLighter = this.colorSchemeService.adjustHexColor(this.colorPick, 25)\n\n img: string|any\n\n constructor() { }\n\n ngOnInit() {\n\n // define image path\n this.img = 'assets/picture.webp'\n this.colorPalletteService.getColorsFromImage(this.img, 8)\n\n\n }\n\n\n}\n\n","<div style=\"margin: 2rem;\">\n\n <h1>Color Conversion Service</h1>\n <div style=\"display: flex; flex-direction: column; gap: 1rem;\">\n <div style=\"display: flex\">\n <div style=\"padding-top: .5rem; margin-right: .5rem;\">rgbToHex: {{ HEX }}</div>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"HEX\"></div>\n </div>\n\n <div style=\"display: flex\">\n <div style=\"padding-top: .5rem; margin-right: .5rem;\"> hexToRgb: {{ RGB }} </div>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"RGB\"></div>\n </div>\n </div>\n\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <h1>Color Light/Darken Service</h1>\n\n <div style=\"display: flex; flex-direction: column; gap: 1rem;\">\n\n <div style=\"display: flex; gap: 1rem\">\n Original Color: #AA11BB<br>\n <div style=\"width: 32px; height: 32px; background-color: #AA11BB;\"></div>\n Lighten (25%): {{ lighten }}<br>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"lighten\"></div>\n Darken (25%): {{ darken }}<br>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"darken\"></div>\n </div>\n\n </div>\n\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <h1>Text Color Utility Services</h1>\n\n <div style=\"display: flex; gap: 1rem; flex-direction: column;\">\n <div style=\"display: flex; gap: 1rem\">\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"darken\"></div>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"lighten\"></div>\n is Darker : {{ colorIsDarker }}\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"colorIsDarker\"></div>\n </div>\n \n <div style=\"display: flex; gap: 1rem; flex-direction: column;\">\n \n <div>\n Use: {{ lightBk }} for '{{ HEX }}' background-color<br>\n <div style=\"padding: 1rem;\" [style.backgroundColor]=\"HEX\" [style.color]=\"darkBk\">\n Sample Text Color\n </div>\n </div>\n\n <div>\n Use: {{ lightBk }} for 'whitesmoke' background-color<br>\n <div style=\"padding: 1rem; background-color: whitesmoke;\" [style.color]=\"lightBk\">\n Sample Text Color\n </div>\n </div>\n </div>\n </div>\n\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n \n <h1>Color Schema Services</h1>\n\n <div style=\"display: flex; gap: 1rem\">\n Pick Color: {{ colorPick }}<br>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"colorPick\"></div>\n Lighter Version: {{ colorPickLighter }}<br>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"colorPickLighter\"></div>\n DarkerVersion: {{ colorPickDarker }}<br>\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"colorPickDarker\"></div>\n </div>\n\n <div style=\"margin-top: 1rem; margin-bottom: 1rem;\">\n <mat-divider></mat-divider>\n </div>\n\n <h1>Color Pallette Service</h1>\n Creates Pallette from Image\n <div style=\"display: flex; gap: 2rem;\">\n <div>\n <img [src]=\"img\" height=\"180\">\n </div>\n\n <div style=\"display: flex; gap: .5rem; width: 120px; border: 1px solid black; flex-wrap: wrap; padding: .5rem;\">\n <div>Color Pick</div>\n <ng-container *ngFor=\"let color of (colors$ | async)\">\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"color.color\"></div>\n </ng-container>\n </div>\n \n <div style=\"display: flex; gap: .5rem; width: 120px; border: 1px solid black; flex-wrap: wrap; padding: .5rem;\">\n <div>Complementary</div>\n <ng-container *ngFor=\"let color of (colors$ | async)\">\n <div style=\"width: 32px; height: 32px;\" [style.backgroundColor]=\"color.complementaryColor\"></div>\n </ng-container>\n </div>\n </div>\n\n</div>\n\n","import { Directive, ElementRef, Renderer2, HostListener, EventEmitter, Output } from '@angular/core';\n\n@Directive({\n selector: '[getColor]'\n})\nexport class ColorExtractorDirective {\n\n @Output() colorValue: EventEmitter<string> = new EventEmitter<string>();\n\n constructor(private elementRef: ElementRef, private renderer: Renderer2) {}\n\n get currentElement() {\n return window.getComputedStyle(this.elementRef.nativeElement);\n }\n\n @HostListener('mouseenter')\n onMouseEnter() {\n // console.log('ENTER', this.currentElement)\n this.colorValue.emit(this.currentElement.getPropertyValue('background-color'))\n }\n\n @HostListener('mouseleave')\n onMouseLeave() {\n // console.log('LEAVE', this.currentElement.getPropertyValue('background-color'))\n this.colorValue.emit('white')\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { ColorGrabberDirective } from './color-grab.directive';\n\nimport { ColorUtilitiesDemoComponent } from './color-utilities-demo/color-utilities-demo.component';\nimport { ColorExtractorDirective } from './color-extractor.directive';\n\n\n@NgModule({\n imports: [\n CommonModule,\n MatButtonModule,\n MatDividerModule\n ],\n declarations: [\n ColorUtilitiesDemoComponent,\n ColorGrabberDirective,\n ColorExtractorDirective\n ],\n exports: [\n ColorUtilitiesDemoComponent\n ]\n})\nexport class ColorUtilHelpersModule { }\n","/*\n * Public API Surface of color-util-helpers\n */\n\nexport * from './lib/color-utils.module';\n\nexport * from './lib/color-utilities-demo/color-utilities-demo.component';\n\nexport * from './lib/color-conversion.service';\nexport * from './lib/color-extractor.directive';\nexport * from './lib/color-grab.directive';\nexport * from './lib/color-pallette.service';\nexport * from './lib/text-color.service';\n\nexport * from './lib/color-scheme.service';\nexport * from './lib/color-lighten-darken.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.ColorConversionService"],"mappings":";;;;;;;;;MAKa,qBAAqB,CAAA;AAQhC,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;KAAK;IAEvC,QAAQ,GAAA;QAEN,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD,QAAA,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC;AACjB,QAAA,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;QAElB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAA6B,CAAC;AAE/D,QAAA,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;QACxB,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC9B,QAAA,GAAG,CAAC,YAAY,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAEpC,QAAA,GAAG,CAAC,MAAM,GAAG,MAAK;AAChB,YAAA,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC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AAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,iBAR/B,2BAA2B;YAC3B,qBAAqB;AACrB,YAAA,uBAAuB,aAPvB,YAAY;YACZ,eAAe;AACf,YAAA,gBAAgB,aAQhB,2BAA2B,CAAA,EAAA,CAAA,CAAA,EAAA;AAGlB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,YAb/B,YAAY;YACZ,eAAe;YACf,gBAAgB,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAWP,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAflC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe;wBACf,gBAAgB;AACjB,qBAAA;AACD,oBAAA,YAAY,EAAE;wBACZ,2BAA2B;wBAC3B,qBAAqB;wBACrB,uBAAuB;AACxB,qBAAA;AACD,oBAAA,OAAO,EAAE;wBACP,2BAA2B;AAC5B,qBAAA;AACF,iBAAA,CAAA;;;ACzBD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ColorConversionService {
|
|
3
|
+
rgbToHex(rgb: number[] | null): string;
|
|
4
|
+
private componentToHex;
|
|
5
|
+
hexToRgb(hex: string | null | undefined): number[];
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorConversionService, never>;
|
|
7
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorConversionService>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ElementRef, Renderer2, EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ColorExtractorDirective {
|
|
4
|
+
private elementRef;
|
|
5
|
+
private renderer;
|
|
6
|
+
colorValue: EventEmitter<string>;
|
|
7
|
+
constructor(elementRef: ElementRef, renderer: Renderer2);
|
|
8
|
+
get currentElement(): CSSStyleDeclaration;
|
|
9
|
+
onMouseEnter(): void;
|
|
10
|
+
onMouseLeave(): void;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorExtractorDirective, never>;
|
|
12
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ColorExtractorDirective, "[getColor]", never, {}, { "colorValue": "colorValue"; }, never, never, false, never>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ElementRef, OnInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ColorGrabberDirective implements OnInit {
|
|
4
|
+
private el;
|
|
5
|
+
ctx?: CanvasRenderingContext2D;
|
|
6
|
+
imageUrl?: string;
|
|
7
|
+
light?: string;
|
|
8
|
+
dark?: string;
|
|
9
|
+
constructor(el: ElementRef);
|
|
10
|
+
ngOnInit(): void;
|
|
11
|
+
textColorBasedOnBgColor(bgColor: string, lightColor?: string, darkColor?: string): string;
|
|
12
|
+
RGB2HSV(rgb: {
|
|
13
|
+
r: any;
|
|
14
|
+
g: any;
|
|
15
|
+
b: any;
|
|
16
|
+
}): {
|
|
17
|
+
saturation: number;
|
|
18
|
+
hue: number;
|
|
19
|
+
value: number;
|
|
20
|
+
};
|
|
21
|
+
HSV2RGB(hsv: any): {
|
|
22
|
+
rgb: string;
|
|
23
|
+
hex: string;
|
|
24
|
+
};
|
|
25
|
+
HueShift(h: any, s: any): any;
|
|
26
|
+
min3(a: any, b: any, c: any): any;
|
|
27
|
+
max3(a: any, b: any, c: any): any;
|
|
28
|
+
lightenDarkenColor(colorCode: any, amount: number): string;
|
|
29
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorGrabberDirective, never>;
|
|
30
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ColorGrabberDirective, "[colorGrabber]", never, { "imageUrl": { "alias": "imageUrl"; "required": false; }; "light": { "alias": "light"; "required": false; }; "dark": { "alias": "dark"; "required": false; }; }, {}, never, never, false, never>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TextColorService } from './text-color.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ColorLightenDarkenService {
|
|
4
|
+
colors: TextColorService;
|
|
5
|
+
constructor();
|
|
6
|
+
lighten(color: string, amount: number): string;
|
|
7
|
+
darken(color: string, amount: number): string;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorLightenDarkenService, never>;
|
|
9
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorLightenDarkenService>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ColorConversionService } from './color-conversion.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ColorPalletteService {
|
|
4
|
+
private colorConversionService;
|
|
5
|
+
private palette;
|
|
6
|
+
palette$: import("rxjs").Observable<{
|
|
7
|
+
color: string;
|
|
8
|
+
complementaryColor: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
constructor(colorConversionService: ColorConversionService);
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves a color palette from an image at the specified path.
|
|
13
|
+
*
|
|
14
|
+
* @param imagePath - The path to the image to extract the color palette from.
|
|
15
|
+
* @param colors - The number of colors to include in the palette (default is 3).
|
|
16
|
+
* @returns An observable that emits the generated color palette.
|
|
17
|
+
*/
|
|
18
|
+
getColorsFromImage(imagePath: string, colors?: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Generates a color palette from an image.
|
|
21
|
+
*
|
|
22
|
+
* @param image - The HTML image element to extract the color palette from.
|
|
23
|
+
* @param colorCount - The number of colors to include in the palette (default is 6).
|
|
24
|
+
* @returns An array of color objects, each with a hex color and a complementary hex color.
|
|
25
|
+
*/
|
|
26
|
+
generateColorPalette(image: HTMLImageElement, colorCount?: number): {
|
|
27
|
+
color: string;
|
|
28
|
+
complementaryColor: string;
|
|
29
|
+
}[] | undefined;
|
|
30
|
+
private getLuminance;
|
|
31
|
+
private calculateColorDistance;
|
|
32
|
+
private calculateMeanColor;
|
|
33
|
+
private kMeansColorQuantization;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorPalletteService, never>;
|
|
35
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorPalletteService>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ColorSchemeService {
|
|
3
|
+
constructor();
|
|
4
|
+
/**
|
|
5
|
+
* Generates a random hexadecimal color code.
|
|
6
|
+
*
|
|
7
|
+
* This function generates a random hue value between 0 and 360 degrees, and random saturation and lightness values between 50% and 100%. It then converts the HSL values to RGB values using the `hslToRgb` function, and finally converts the RGB values to a hexadecimal color code using the `rgbToHex` function.
|
|
8
|
+
*
|
|
9
|
+
* @returns A hexadecimal color code in the format "#RRGGBB".
|
|
10
|
+
*/
|
|
11
|
+
generateRandomColor(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Converts HSL (Hue, Saturation, Lightness) color values to RGB (Red, Green, Blue) color values.
|
|
14
|
+
*
|
|
15
|
+
* @param h - The hue value, ranging from 0 to 360 degrees.
|
|
16
|
+
* @param s - The saturation value, ranging from 0 to 100 percent.
|
|
17
|
+
* @param l - The lightness value, ranging from 0 to 100 percent.
|
|
18
|
+
* @returns An object with the RGB color values, where each value is between 0 and 255.
|
|
19
|
+
*/
|
|
20
|
+
hslToRgb(h: number, s: number, l: number): {
|
|
21
|
+
r: number;
|
|
22
|
+
g: number;
|
|
23
|
+
b: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Converts RGB color values to a hexadecimal color string.
|
|
27
|
+
*
|
|
28
|
+
* @param r - The red color value, between 0 and 255.
|
|
29
|
+
* @param g - The green color value, between 0 and 255.
|
|
30
|
+
* @param b - The blue color value, between 0 and 255.
|
|
31
|
+
* @returns A hexadecimal color string in the format "#RRGGBB".
|
|
32
|
+
*/
|
|
33
|
+
rgbToHex(r: number, g: number, b: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Adjusts a hexadecimal color value by a given percentage.
|
|
36
|
+
*
|
|
37
|
+
* @param hexColor - The hexadecimal color value to adjust.
|
|
38
|
+
* @param percentage - The percentage to adjust the color by, ranging from -100 to 100.
|
|
39
|
+
* @returns The adjusted hexadecimal color value.
|
|
40
|
+
*/
|
|
41
|
+
adjustHexColor(hexColor: string, percentage: number): string;
|
|
42
|
+
clamp(value: number): number;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorSchemeService, never>;
|
|
44
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ColorSchemeService>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import { ColorConversionService } from '../color-conversion.service';
|
|
3
|
+
import { ColorPalletteService } from '../color-pallette.service';
|
|
4
|
+
import { TextColorService } from '../text-color.service';
|
|
5
|
+
import { ColorLightenDarkenService } from '../color-lighten-darken.service';
|
|
6
|
+
import { ColorSchemeService } from '../color-scheme.service';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class ColorUtilitiesDemoComponent implements OnInit {
|
|
9
|
+
colorConversionService: ColorConversionService;
|
|
10
|
+
colorLightenDarkenService: ColorLightenDarkenService;
|
|
11
|
+
colorPalletteService: ColorPalletteService;
|
|
12
|
+
textColorService: TextColorService;
|
|
13
|
+
colorSchemeService: ColorSchemeService;
|
|
14
|
+
HEX: string;
|
|
15
|
+
RGB: string;
|
|
16
|
+
lighten: string;
|
|
17
|
+
darken: string;
|
|
18
|
+
colorIsDarker: boolean;
|
|
19
|
+
darkBk: string;
|
|
20
|
+
lightBk: string;
|
|
21
|
+
palette: any;
|
|
22
|
+
colors$: import("rxjs").Observable<{
|
|
23
|
+
color: string;
|
|
24
|
+
complementaryColor: string;
|
|
25
|
+
}[]>;
|
|
26
|
+
colorPick: string;
|
|
27
|
+
colorPickDarker: string;
|
|
28
|
+
colorPickLighter: string;
|
|
29
|
+
img: string | any;
|
|
30
|
+
constructor();
|
|
31
|
+
ngOnInit(): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorUtilitiesDemoComponent, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ColorUtilitiesDemoComponent, "app-color-utilities-demo", never, {}, {}, never, never, false, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./color-utilities-demo/color-utilities-demo.component";
|
|
3
|
+
import * as i2 from "./color-grab.directive";
|
|
4
|
+
import * as i3 from "./color-extractor.directive";
|
|
5
|
+
import * as i4 from "@angular/common";
|
|
6
|
+
import * as i5 from "@angular/material/button";
|
|
7
|
+
import * as i6 from "@angular/material/divider";
|
|
8
|
+
export declare class ColorUtilHelpersModule {
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColorUtilHelpersModule, never>;
|
|
10
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ColorUtilHelpersModule, [typeof i1.ColorUtilitiesDemoComponent, typeof i2.ColorGrabberDirective, typeof i3.ColorExtractorDirective], [typeof i4.CommonModule, typeof i5.MatButtonModule, typeof i6.MatDividerModule], [typeof i1.ColorUtilitiesDemoComponent]>;
|
|
11
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ColorUtilHelpersModule>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColorConversionService } from './color-conversion.service';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class TextColorService {
|
|
4
|
+
private colorConversionService;
|
|
5
|
+
constructor(colorConversionService: ColorConversionService);
|
|
6
|
+
textColorForBgColor(bgColor: string, lightColor: string, darkColor: string): string;
|
|
7
|
+
darkerColor(color1: string, color2: string): string;
|
|
8
|
+
isColorDarker(color1: string, color2: string): boolean;
|
|
9
|
+
lighterColor(color1: string, color2: string): string;
|
|
10
|
+
isColorLighter(color1: string, color2: string): boolean;
|
|
11
|
+
calculateLuminance(r: number, g: number, b: number): number;
|
|
12
|
+
fixColor(color: string): number[];
|
|
13
|
+
isValidHex(color: string): boolean;
|
|
14
|
+
hexToRgb(hex: string): number[];
|
|
15
|
+
parseRgb(rgb: string): number[];
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TextColorService, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TextColorService>;
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "color-util-helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^15.2.0",
|
|
6
6
|
"@angular/core": "^15.2.0"
|
|
@@ -8,5 +8,18 @@
|
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.3.0"
|
|
10
10
|
},
|
|
11
|
-
"sideEffects": false
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/color-util-helpers.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"esm2022": "./esm2022/color-util-helpers.mjs",
|
|
21
|
+
"esm": "./esm2022/color-util-helpers.mjs",
|
|
22
|
+
"default": "./fesm2022/color-util-helpers.mjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
12
25
|
}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Public API Surface of color-utils
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
export * from './lib/color-utils.module';
|
|
6
2
|
export * from './lib/color-utilities-demo/color-utilities-demo.component';
|
|
7
|
-
|
|
8
3
|
export * from './lib/color-conversion.service';
|
|
9
4
|
export * from './lib/color-extractor.directive';
|
|
10
5
|
export * from './lib/color-grab.directive';
|
|
11
6
|
export * from './lib/color-pallette.service';
|
|
12
7
|
export * from './lib/text-color.service';
|
|
13
|
-
|
|
14
8
|
export * from './lib/color-scheme.service';
|
|
15
9
|
export * from './lib/color-lighten-darken.service';
|
package/ng-package.json
DELETED
|
Binary file
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
import { ColorConversionService } from './color-conversion.service';
|
|
3
|
-
|
|
4
|
-
describe('ColorConversionService', () => {
|
|
5
|
-
let service: ColorConversionService;
|
|
6
|
-
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
TestBed.configureTestingModule({});
|
|
9
|
-
service = TestBed.inject(ColorConversionService);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('rgbToHex', () => {
|
|
13
|
-
it('should convert RGB to hex', () => {
|
|
14
|
-
expect(service.rgbToHex([255, 0, 0])).toBe('#ff0000');
|
|
15
|
-
expect(service.rgbToHex([0, 255, 0])).toBe('#00ff00');
|
|
16
|
-
expect(service.rgbToHex([0, 0, 255])).toBe('#0000ff');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('should return empty string for null input', () => {
|
|
20
|
-
expect(service.rgbToHex(null)).toBe('');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('should return empty string for empty array input', () => {
|
|
24
|
-
expect(service.rgbToHex([])).toBe('');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should handle invalid RGB values', () => {
|
|
28
|
-
expect(service.rgbToHex([256, -1, 300])).toBe('');
|
|
29
|
-
expect(service.rgbToHex([255, 255])).toBe('');
|
|
30
|
-
expect(service.rgbToHex([255, 255, 255, 255])).toBe('');
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('hexToRgb', () => {
|
|
35
|
-
it('should convert hex to RGB', () => {
|
|
36
|
-
expect(service.hexToRgb('#ff0000')).toEqual([255, 0, 0]);
|
|
37
|
-
expect(service.hexToRgb('#00ff00')).toEqual([0, 255, 0]);
|
|
38
|
-
expect(service.hexToRgb('#0000ff')).toEqual([0, 0, 255]);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should return empty array for null input', () => {
|
|
42
|
-
expect(service.hexToRgb(null)).toEqual([]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should return empty array for undefined input', () => {
|
|
46
|
-
expect(service.hexToRgb(undefined)).toEqual([]);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return empty array for invalid hex values', () => {
|
|
50
|
-
expect(service.hexToRgb('#zzz')).toEqual([]);
|
|
51
|
-
expect(service.hexToRgb('#12345')).toEqual([]);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Injectable({
|
|
4
|
-
providedIn: 'root'
|
|
5
|
-
})
|
|
6
|
-
export class ColorConversionService {
|
|
7
|
-
|
|
8
|
-
rgbToHex(rgb: number[] | null): string {
|
|
9
|
-
if (rgb === null || rgb.length !== 3 || rgb.some(value => value < 0 || value > 255)) return '';
|
|
10
|
-
|
|
11
|
-
const [r, g, b] = rgb;
|
|
12
|
-
const hexR = this.componentToHex(r);
|
|
13
|
-
const hexG = this.componentToHex(g);
|
|
14
|
-
const hexB = this.componentToHex(b);
|
|
15
|
-
return "#" + hexR + hexG + hexB;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private componentToHex = (c: number) => {
|
|
19
|
-
const hex = c.toString(16);
|
|
20
|
-
return hex.length === 1 ? "0" + hex : hex;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
hexToRgb(hex: string | null | undefined): number[] {
|
|
24
|
-
if (hex === null || hex === undefined) return [];
|
|
25
|
-
|
|
26
|
-
hex = (hex.length === 3) ? hex + hex : hex;
|
|
27
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
28
|
-
|
|
29
|
-
return result ? [
|
|
30
|
-
parseInt(result[1], 16),
|
|
31
|
-
parseInt(result[2], 16),
|
|
32
|
-
parseInt(result[3], 16)
|
|
33
|
-
] : [];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ColorExtractorDirective } from './color-extractor.directive';
|
|
2
|
-
import { Component, DebugElement } from '@angular/core';
|
|
3
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
4
|
-
import { By } from '@angular/platform-browser';
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
template: `<div getColor (colorValue)="onColorChange($event)" style="background-color: red;"></div>`
|
|
8
|
-
})
|
|
9
|
-
class TestHostComponent {
|
|
10
|
-
|
|
11
|
-
color = ''
|
|
12
|
-
|
|
13
|
-
onColorChange(color: string) {
|
|
14
|
-
this.color = color;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('ColorExtractorDirective', () => {
|
|
19
|
-
let fixture: ComponentFixture<TestHostComponent>;
|
|
20
|
-
let divEl: DebugElement;
|
|
21
|
-
|
|
22
|
-
beforeEach(() => {
|
|
23
|
-
TestBed.configureTestingModule({
|
|
24
|
-
declarations: [ColorExtractorDirective, TestHostComponent]
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
fixture = TestBed.createComponent(TestHostComponent);
|
|
28
|
-
divEl = fixture.debugElement.query(By.directive(ColorExtractorDirective));
|
|
29
|
-
fixture.detectChanges();
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should create an instance', () => {
|
|
33
|
-
expect(divEl).toBeTruthy();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should emit background color on mouse enter', () => {
|
|
37
|
-
spyOn(fixture.componentInstance, 'onColorChange');
|
|
38
|
-
divEl.triggerEventHandler('mouseenter', null);
|
|
39
|
-
fixture.detectChanges();
|
|
40
|
-
expect(fixture.componentInstance.onColorChange).toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should emit white color on mouse leave', () => {
|
|
44
|
-
spyOn(fixture.componentInstance, 'onColorChange');
|
|
45
|
-
divEl.triggerEventHandler('mouseleave', null);
|
|
46
|
-
fixture.detectChanges();
|
|
47
|
-
expect(fixture.componentInstance.onColorChange).toHaveBeenCalledWith('white');
|
|
48
|
-
});
|
|
49
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, Renderer2, HostListener, EventEmitter, Output } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
@Directive({
|
|
4
|
-
selector: '[getColor]'
|
|
5
|
-
})
|
|
6
|
-
export class ColorExtractorDirective {
|
|
7
|
-
|
|
8
|
-
@Output() colorValue: EventEmitter<string> = new EventEmitter<string>();
|
|
9
|
-
|
|
10
|
-
constructor(private elementRef: ElementRef, private renderer: Renderer2) {}
|
|
11
|
-
|
|
12
|
-
get currentElement() {
|
|
13
|
-
return window.getComputedStyle(this.elementRef.nativeElement);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
@HostListener('mouseenter')
|
|
17
|
-
onMouseEnter() {
|
|
18
|
-
// console.log('ENTER', this.currentElement)
|
|
19
|
-
this.colorValue.emit(this.currentElement.getPropertyValue('background-color'))
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@HostListener('mouseleave')
|
|
23
|
-
onMouseLeave() {
|
|
24
|
-
// console.log('LEAVE', this.currentElement.getPropertyValue('background-color'))
|
|
25
|
-
this.colorValue.emit('white')
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|