Skip to content

Commit

Permalink
hotfix?(frontend): getBgColorの判定式を軽量化
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyme authored Oct 12, 2024
1 parent 54e625d commit 06155bf
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions packages/frontend/src/scripts/tms/get-bg-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

import tinycolor from 'tinycolor2';

export const getBgColor = (elem?: Element | null | undefined): string | null => {
if (elem == null) return null;

const { backgroundColor: bg } = window.getComputedStyle(elem);

if (bg && tinycolor(bg).getAlpha() !== 0) {
if (bg && !['rgba(0, 0, 0, 0)', 'rgba(0,0,0,0)', 'transparent'].includes(bg)) {
return bg;
}

Expand Down

0 comments on commit 06155bf

Please sign in to comment.