161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Provide APIs to set system uiAppearance. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace uiAppearance 2761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 2861847f8eSopenharmony_ci * @systemapi hide this for inner system use 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace uiAppearance { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Enumerates dark-mode. 3461847f8eSopenharmony_ci * 3561847f8eSopenharmony_ci * @enum { number } 3661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 3761847f8eSopenharmony_ci * @systemapi hide this for inner system use 3861847f8eSopenharmony_ci * @since 10 3961847f8eSopenharmony_ci */ 4061847f8eSopenharmony_ci enum DarkMode { 4161847f8eSopenharmony_ci /** 4261847f8eSopenharmony_ci * Always display with dark mode. 4361847f8eSopenharmony_ci * 4461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 4561847f8eSopenharmony_ci * @systemapi hide this for inner system use 4661847f8eSopenharmony_ci * @since 10 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci ALWAYS_DARK = 0, 4961847f8eSopenharmony_ci 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * Always display with light mode. 5261847f8eSopenharmony_ci * 5361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 5461847f8eSopenharmony_ci * @systemapi hide this for inner system use 5561847f8eSopenharmony_ci * @since 10 5661847f8eSopenharmony_ci */ 5761847f8eSopenharmony_ci ALWAYS_LIGHT = 1 5861847f8eSopenharmony_ci } 5961847f8eSopenharmony_ci 6061847f8eSopenharmony_ci /** 6161847f8eSopenharmony_ci * Set the system dark-mode. 6261847f8eSopenharmony_ci * 6361847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 6461847f8eSopenharmony_ci * @param { DarkMode } mode - indicates the dark-mode to set 6561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setDarkMode 6661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 6761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 6861847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 6961847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 7061847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 7161847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 7261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 7361847f8eSopenharmony_ci * @systemapi hide this for inner system use 7461847f8eSopenharmony_ci * @since 10 7561847f8eSopenharmony_ci */ 7661847f8eSopenharmony_ci function setDarkMode(mode: DarkMode, callback: AsyncCallback<void>): void; 7761847f8eSopenharmony_ci 7861847f8eSopenharmony_ci /** 7961847f8eSopenharmony_ci * Set the system dark-mode. 8061847f8eSopenharmony_ci * 8161847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 8261847f8eSopenharmony_ci * @param { DarkMode } mode - indicates the dark-mode to set 8361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function 8461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 8561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 8661847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 8761847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 8861847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 8961847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 9061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 9161847f8eSopenharmony_ci * @systemapi hide this for inner system use 9261847f8eSopenharmony_ci * @since 10 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci function setDarkMode(mode: DarkMode): Promise<void>; 9561847f8eSopenharmony_ci 9661847f8eSopenharmony_ci /** 9761847f8eSopenharmony_ci * Acquire the current dark-mode. 9861847f8eSopenharmony_ci * 9961847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 10061847f8eSopenharmony_ci * @returns { DarkMode } current dark-mode. 10161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 10261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 10361847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 10461847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 10561847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 10661847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 10761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 10861847f8eSopenharmony_ci * @systemapi hide this for inner system use 10961847f8eSopenharmony_ci * @since 10 11061847f8eSopenharmony_ci */ 11161847f8eSopenharmony_ci function getDarkMode(): DarkMode; 11261847f8eSopenharmony_ci 11361847f8eSopenharmony_ci /** 11461847f8eSopenharmony_ci * Set the system font-scale. 11561847f8eSopenharmony_ci * 11661847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 11761847f8eSopenharmony_ci * @param { number } fontScale - indicates the font-scale to set 11861847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function 11961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 12061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 12161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 12261847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 12361847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 12461847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 12561847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 12661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 12761847f8eSopenharmony_ci * @systemapi hide this for inner system use 12861847f8eSopenharmony_ci * @since 12 12961847f8eSopenharmony_ci */ 13061847f8eSopenharmony_ci function setFontScale(fontScale: number): Promise<void>; 13161847f8eSopenharmony_ci 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * Acquire the current font-scale. 13461847f8eSopenharmony_ci * 13561847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 13661847f8eSopenharmony_ci * @returns { number } current font-scale. 13761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 13861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 13961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 14061847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 14161847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 14261847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 14361847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 14461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 14561847f8eSopenharmony_ci * @systemapi hide this for inner system use 14661847f8eSopenharmony_ci * @since 12 14761847f8eSopenharmony_ci */ 14861847f8eSopenharmony_ci function getFontScale(): number; 14961847f8eSopenharmony_ci 15061847f8eSopenharmony_ci /** 15161847f8eSopenharmony_ci * Set the system font-weight-scale. 15261847f8eSopenharmony_ci * 15361847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 15461847f8eSopenharmony_ci * @param { number } fontWeightScale - indicates the font-weight-scale to set 15561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function 15661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 15761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 15861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 15961847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 16061847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 16161847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 16261847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 16361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 16461847f8eSopenharmony_ci * @systemapi hide this for inner system use 16561847f8eSopenharmony_ci * @since 12 16661847f8eSopenharmony_ci */ 16761847f8eSopenharmony_ci function setFontWeightScale(fontWeightScale: number): Promise<void>; 16861847f8eSopenharmony_ci 16961847f8eSopenharmony_ci /** 17061847f8eSopenharmony_ci * Acquire the current font-weight-scale. 17161847f8eSopenharmony_ci * 17261847f8eSopenharmony_ci * @permission ohos.permission.UPDATE_CONFIGURATION 17361847f8eSopenharmony_ci * @returns { number } current font-weight-scale. 17461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 17561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 17661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 17761847f8eSopenharmony_ci * <br> 1. Mandatory parameters are left unspecified. 17861847f8eSopenharmony_ci * <br> 2. Incorrect parameters types. 17961847f8eSopenharmony_ci * <br> 3. Parameter verification failed. 18061847f8eSopenharmony_ci * @throws { BusinessError } 500001 - Internal error. 18161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.UiAppearance 18261847f8eSopenharmony_ci * @systemapi hide this for inner system use 18361847f8eSopenharmony_ci * @since 12 18461847f8eSopenharmony_ci */ 18561847f8eSopenharmony_ci function getFontWeightScale(): number; 18661847f8eSopenharmony_ci} 18761847f8eSopenharmony_ciexport default uiAppearance; 188