diff --git a/src/components/sq-button/sq-button.component.ts b/src/components/sq-button/sq-button.component.ts index 77e7298..b82b2a1 100644 --- a/src/components/sq-button/sq-button.component.ts +++ b/src/components/sq-button/sq-button.component.ts @@ -239,9 +239,9 @@ export class SqButtonComponent { */ setHoverBg() { if (this.invertedHover) { - return this.setHover(this.textColor || '') + return this.setHover(this.textColor !== 'transparent' ? this.textColor || '' : 'var(--text_color)') } - return this.setHover(this.color) + return this.setHover(this.color !== 'transparent' ? this.color : 'var(--color_bg_button_inverse-hover)') } /** @@ -250,9 +250,9 @@ export class SqButtonComponent { */ setHoverText() { if (this.invertedHover) { - return this.setHover(this.color !== 'transparent' ? this.color : 'var(--white-html)') + return this.setHover(this.color !== 'transparent' ? this.color : 'var(--color_bg_button_inverse-hover)') } - return this.setHover(this.textColor !== 'transparent' ? this.textColor || '' : 'var(--white-html)') + return this.setHover(this.textColor !== 'transparent' ? this.textColor || '' : 'var(--text_color)') } /** diff --git a/src/helpers/colors.helper.ts b/src/helpers/colors.helper.ts index 13c7639..346abca 100644 --- a/src/helpers/colors.helper.ts +++ b/src/helpers/colors.helper.ts @@ -60,6 +60,15 @@ export class ColorsHelper { .join('') } + const isHexColor = (value: string): boolean => { + const hexColorRegex = /^([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$/ + return hexColorRegex.test(value) + } + + if (!isHexColor(colorWithoutHash)) { + return colorWithoutHash + } + const getColorChannel = (substring: string): string => { let colorChannel = Math.max(Math.min(255, parseInt(substring, 16) + amount), 0).toString(16) if (colorChannel?.length < 2) { diff --git a/src/package.json b/src/package.json index 9333f65..84bd502 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "@squidit/ngx-css", - "version": "1.3.33", + "version": "1.3.34", "peerDependencies": { "@angular/common": ">=15.0.0", "@angular/core": ">=15.0.0",