import { IPortal } from "@esri/arcgis-rest-portal" ; import { DEFAULT_THEME } from "./default-theme" ; import { cloneObject , getProp , removeEmptyProps , extend } from "@esri/hub-common" ; import { IHubSiteTheme } from "./types" ; param { Object } portalSelf export function getTheme ( portalSelf ) { let defaultTheme = cloneObject ( DEFAULT_THEME ) ; let sharedTheme = getProp ( portalSelf , "portalProperties.sharedTheme" ) ; if ( sharedTheme ) { sharedTheme = removeEmptyProps ( sharedTheme ) ; defaultTheme = extend ( defaultTheme , sharedTheme ) as IHubSiteTheme ; } return defaultTheme ; }