Files
discord-decomp/design/components/Icon/native/CutoutBackgroundContext.tsx
T
2026-11-01 12:12:55 +02:00

33 lines
1.2 KiB
TypeScript

// Metro module 7971 (f7972).
import { createContext, useContext } from "react";
import Module689 from "../../../../_bundle/Module689";
import { flattenColorOverOpaqueBackground } from "../../../utils/shared/colors";
import Module712 from "../../../../_bundle/Module712";
import { useToken } from "../../../tokens/native/useToken";
const context = createContext(void 0);
export function useCutoutBackgroundColor() {
return useContext(context);
}
export function CutoutBackgroundProvider(props) {
let value;
const { backgroundColor, children } = props;
const context2 = useContext(context);
const token = useToken(Module712.internal.isSemanticColor(backgroundColor) ? backgroundColor : void 0);
const r25 = backgroundColor !== null ? typeof backgroundColor === "string" ? backgroundColor : token : null;
L12: {
if (r25 != null) {
value = Module689(r25).alpha() !== 1 ? context2 != null ? flattenColorOverOpaqueBackground(r25, context2) : void 0 : r25;
} else {
if (r25 === void 0) {
value = context2;
if (value != null) {
break L12;
}
}
r25 == null;
value = void 0;
}
}
return <context.Provider value={value}>{children}</context.Provider>;
}