1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22 23/** 24 * Provide APIs to set system uiAppearance. 25 * 26 * @namespace uiAppearance 27 * @syscap SystemCapability.ArkUI.UiAppearance 28 * @systemapi hide this for inner system use 29 * @since 10 30 */ 31declare namespace uiAppearance { 32 /** 33 * Enumerates dark-mode. 34 * 35 * @enum { number } 36 * @syscap SystemCapability.ArkUI.UiAppearance 37 * @systemapi hide this for inner system use 38 * @since 10 39 */ 40 enum DarkMode { 41 /** 42 * Always display with dark mode. 43 * 44 * @syscap SystemCapability.ArkUI.UiAppearance 45 * @systemapi hide this for inner system use 46 * @since 10 47 */ 48 ALWAYS_DARK = 0, 49 50 /** 51 * Always display with light mode. 52 * 53 * @syscap SystemCapability.ArkUI.UiAppearance 54 * @systemapi hide this for inner system use 55 * @since 10 56 */ 57 ALWAYS_LIGHT = 1 58 } 59 60 /** 61 * Set the system dark-mode. 62 * 63 * @permission ohos.permission.UPDATE_CONFIGURATION 64 * @param { DarkMode } mode - indicates the dark-mode to set 65 * @param { AsyncCallback<void> } callback - the callback of setDarkMode 66 * @throws { BusinessError } 201 - Permission denied. 67 * @throws { BusinessError } 401 - Parameter error. Possible causes: 68 * <br> 1. Mandatory parameters are left unspecified. 69 * <br> 2. Incorrect parameters types. 70 * <br> 3. Parameter verification failed. 71 * @throws { BusinessError } 500001 - Internal error. 72 * @syscap SystemCapability.ArkUI.UiAppearance 73 * @systemapi hide this for inner system use 74 * @since 10 75 */ 76 function setDarkMode(mode: DarkMode, callback: AsyncCallback<void>): void; 77 78 /** 79 * Set the system dark-mode. 80 * 81 * @permission ohos.permission.UPDATE_CONFIGURATION 82 * @param { DarkMode } mode - indicates the dark-mode to set 83 * @returns { Promise<void> } the promise returned by the function 84 * @throws { BusinessError } 201 - Permission denied. 85 * @throws { BusinessError } 401 - Parameter error. Possible causes: 86 * <br> 1. Mandatory parameters are left unspecified. 87 * <br> 2. Incorrect parameters types. 88 * <br> 3. Parameter verification failed. 89 * @throws { BusinessError } 500001 - Internal error. 90 * @syscap SystemCapability.ArkUI.UiAppearance 91 * @systemapi hide this for inner system use 92 * @since 10 93 */ 94 function setDarkMode(mode: DarkMode): Promise<void>; 95 96 /** 97 * Acquire the current dark-mode. 98 * 99 * @permission ohos.permission.UPDATE_CONFIGURATION 100 * @returns { DarkMode } current dark-mode. 101 * @throws { BusinessError } 201 - Permission denied. 102 * @throws { BusinessError } 401 - Parameter error. Possible causes: 103 * <br> 1. Mandatory parameters are left unspecified. 104 * <br> 2. Incorrect parameters types. 105 * <br> 3. Parameter verification failed. 106 * @throws { BusinessError } 500001 - Internal error. 107 * @syscap SystemCapability.ArkUI.UiAppearance 108 * @systemapi hide this for inner system use 109 * @since 10 110 */ 111 function getDarkMode(): DarkMode; 112} 113export default uiAppearance; 114