Skip to content

Commit

Permalink
Merge pull request #61 from squidit/Adjust/SQ-64192
Browse files Browse the repository at this point in the history
Adjust/SQ-64192
  • Loading branch information
danielpcs committed May 22, 2024
2 parents 058592b + 23e2d04 commit 15b8a9e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/sq-button/sq-button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
}

/**
Expand All @@ -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)')
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/helpers/colors.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 15b8a9e

Please sign in to comment.