1bea4f105Sopenharmony_ci/* 2bea4f105Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3bea4f105Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bea4f105Sopenharmony_ci * you may not use this file except in compliance with the License. 5bea4f105Sopenharmony_ci * You may obtain a copy of the License at 6bea4f105Sopenharmony_ci * 7bea4f105Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bea4f105Sopenharmony_ci * 9bea4f105Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bea4f105Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bea4f105Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bea4f105Sopenharmony_ci * See the License for the specific language governing permissions and 13bea4f105Sopenharmony_ci * limitations under the License. 14bea4f105Sopenharmony_ci */ 15bea4f105Sopenharmony_ci 16bea4f105Sopenharmony_ciimport window from '@ohos.window'; 17bea4f105Sopenharmony_ciimport Logger from '../log/Logger'; 18bea4f105Sopenharmony_ciimport ObjectUtil from './ObjectUtil'; 19bea4f105Sopenharmony_ci 20bea4f105Sopenharmony_ciconst TAG = 'UiUtil'; 21bea4f105Sopenharmony_ci 22bea4f105Sopenharmony_ciexport class UiUtil { 23bea4f105Sopenharmony_ci 24bea4f105Sopenharmony_ci public static setWindowBackground(color: string): void { 25bea4f105Sopenharmony_ci let windowClass: window.Window = globalThis.windowClass; 26bea4f105Sopenharmony_ci if (!ObjectUtil.isNullOrUndefined(windowClass)) { 27bea4f105Sopenharmony_ci try { 28bea4f105Sopenharmony_ci windowClass.setWindowBackgroundColor(color); 29bea4f105Sopenharmony_ci } catch (err) { 30bea4f105Sopenharmony_ci Logger.e(TAG, 'setWindowBackgroundColor error: ' + JSON.stringify(err)); 31bea4f105Sopenharmony_ci } 32bea4f105Sopenharmony_ci } 33bea4f105Sopenharmony_ci } 34bea4f105Sopenharmony_ci}