Skip to content

Commit cafaa8f

Browse files
committed
feat: Add getAcrylicTextureStyle.ts
1 parent 18a81ed commit cafaa8f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/common/browser/backdropFilterDetector.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ export function isSupportBackdropFilter() {
66
if (CSS && CSS.supports) {
77
return CSS.supports("backdrop-filter", propertyValue);
88
} else {
9-
const { style } = document.createElement("div");
9+
let elm = document.createElement("div");
10+
const { style } = elm;
1011
isSupported = style[propertyName] !== void 0;
1112
if (isSupported) {
1213
style[propertyName] = propertyValue;
1314
isSupported = style.cssText.length !== 0;
1415
}
16+
elm = null;
1517

1618
return isSupported;
1719
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { isSupportBackdropFilter } from "../common/browser/backdropFilterDetector";
2+
3+
export function getAcrylicTextureStyle(): CSSStyleDeclaration {
4+
const isSupported = isSupportBackdropFilter();
5+
let style: CSSStyleDeclaration;
6+
if (isSupported) {
7+
style = {
8+
/**
9+
* Add theme.baseLow color.
10+
*/
11+
backgroundColor: "",
12+
/**
13+
* Add noise texture.
14+
*/
15+
backgroundImage: "",
16+
/**
17+
* Add blur filter.
18+
*/
19+
backdropFilter: "blur(10px)"
20+
} as any;
21+
} else {
22+
style = {
23+
/**
24+
* Add polyfill texture theme.acrylicText40.
25+
*/
26+
background: ""
27+
} as CSSStyleDeclaration;
28+
}
29+
30+
return style;
31+
}

0 commit comments

Comments
 (0)