Skip to content

Commit 88a75a1

Browse files
fix(offerwall): button contrast adjustment (#621)
Co-authored-by: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com>
1 parent ca95b18 commit 88a75a1

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

components/src/offerwall/components/install-required/install-required.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ h2 {
6161
border-radius: var(--Radius-Moderate-rounding);
6262

6363
background: var(--accent-color);
64+
/* contrast-color() is unreliable in Chrome shadow DOM; approximate with OKLCH:
65+
https://css-tricks.com/approximating-contrast-color-with-other-css-features/ */
6466
color: white;
65-
color: contrast-color(var(--accent-color));
67+
color: oklch(from var(--accent-color) round(1.21 - L) 0 0);
6668
}
6769

6870
.step-icon {

components/src/offerwall/components/install-required/install-required.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import iconWallet from '@c/assets/icon_wallet.svg?raw'
66
import iconClose from '@c/assets/icon_x_close.svg?raw'
77
import { PoweredByInterledger } from '@c/shared/powered-by-interledger'
88
import { WebMonetizationHeader } from '@c/shared/web-monetization-header'
9-
import { getContrastColor } from '@c/utils'
109
import { getExtensionHref } from '@shared/utils/extension'
1110
import styles from './install-required.css?raw'
1211
import styleTokens from '../../vars.css?raw'
@@ -90,13 +89,6 @@ export class InstallRequired extends LitElement {
9089
`
9190
}
9291

93-
firstUpdated(): void {
94-
if (!CSS.supports('color: contrast-color(black)')) {
95-
const el = this.renderRoot.querySelector<HTMLAnchorElement>('a.button')!
96-
el.style.color = getContrastColor(getComputedStyle(el).backgroundColor)
97-
}
98-
}
99-
10092
get extensionUrl(): string {
10193
return getExtensionHref('offerwall')
10294
}

0 commit comments

Comments
 (0)