/*! * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and limitations under the License. */ import { type RefObject } from "react"; export type ContrastMode = "lowContrast" | "highContrast"; export type ContrastModeContextType = { /** * Odyssey's app wrapper element: the contrast and height container `OdysseyThemeProvider` renders. `useAppElementContainerQuery` observes it so container queries track the space Odyssey actually occupies. Absent outside a provider, and `current` stays `null` when the provider renders with `hasWrapperElement={false}`. */ contrastContainerRef?: RefObject; contrastMode: ContrastMode; }; export declare const ContrastModeContext: import("react").Context; export declare const defaultContrast = "lowContrast"; export declare const useContrastModeContext: () => ContrastModeContextType; export declare const hueNeutral50Rgb: string; export declare const isTransparentColor: (color: string) => color is "transparent" | "rgba(0, 0, 0, 0)"; export declare const normalizeRgbaToRgb: (rgba: string) => string; export declare const getElementComputedBackgroundColor: (element: HTMLElement) => string; export declare const normalizeBackgroundColor: (bgColor: string) => string; /** Default background color when none is detected: HueNeutral50 (gray = highContrast). */ export declare const defaultParentBackgroundColor: string; /** * Determines the effective background color of an element. * * @param element - The HTML element to check. * @returns The effective background color. Returns defaultParentBackgroundColor if no non-transparent background is found. * * Note: * - Low contrast mode is used for white background (HueNeutralWhite). * - High contrast mode is used for gray background (defaultParentBackgroundColor = HueNeutral50). * - Crosses shadow DOM boundaries via `getRootNode().host` to detect backgrounds set outside of shadow roots. */ export declare const getBackgroundColor: (element: HTMLElement | null) => string; export declare const deriveContrastMode: (bgColor: string) => ContrastMode; type UseContrastModeProps = { contrastMode?: ContrastMode; }; export declare const useContrastMode: ({ contrastMode: explicitContrastMode, }: UseContrastModeProps) => { contrastContainerRef: RefObject; contrastMode: ContrastMode; parentBackgroundColor: string; }; export {}; //# sourceMappingURL=useContrastMode.d.ts.map