UNPKG

@asgardeo/javascript

Version:
49 lines (48 loc) 2.11 kB
/** * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with 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 { BrandingPreference } from '../models/branding-preference'; import { Theme } from '../theme/types'; /** * Transforms branding preference response to Theme object * * @param brandingPreference - The branding preference response from getBrandingPreference * @param forceTheme - Optional parameter to force a specific theme ('light' or 'dark'), * if not provided, will use the activeTheme from branding preference * @returns Theme object that can be used with the theme system * * The function extracts the following from branding preference: * - Colors (primary, secondary, background, text, alerts, etc.) * - Border radius from buttons and inputs * - Images (logo and favicon with their URLs, titles, and alt text) * - Typography settings * * @example * ```typescript * const brandingPreference = await getBrandingPreference({ baseUrl: "..." }); * const theme = transformBrandingPreferenceToTheme(brandingPreference); * * // Access image URLs via CSS variables * // Logo: var(--wso2-image-logo-url) * // Favicon: var(--wso2-image-favicon-url) * * // Force light theme regardless of branding preference activeTheme * const lightTheme = transformBrandingPreferenceToTheme(brandingPreference, 'light'); * ``` */ export declare const transformBrandingPreferenceToTheme: (brandingPreference: BrandingPreference, forceTheme?: "light" | "dark") => Theme; export default transformBrandingPreferenceToTheme;