• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
31 /**
32 * Provide APIs to set system uiAppearance.
33 *
34 * @namespace uiAppearance
35 * @syscap SystemCapability.ArkUI.UiAppearance
36 * @since 20
37 */
38declare namespace uiAppearance {
39  /**
40   * Enumerates dark-mode.
41   *
42   * @enum { number }
43   * @syscap SystemCapability.ArkUI.UiAppearance
44   * @systemapi hide this for inner system use
45   * @since 10
46   */
47  /**
48   * Enumerates dark-mode.
49   *
50   * @enum { number }
51   * @syscap SystemCapability.ArkUI.UiAppearance
52   * @since 20
53   */
54  enum DarkMode {
55    /**
56     * Always display with dark mode.
57     *
58     * @syscap SystemCapability.ArkUI.UiAppearance
59     * @systemapi hide this for inner system use
60     * @since 10
61     */
62    /**
63     * Always display with dark mode.
64     *
65     * @syscap SystemCapability.ArkUI.UiAppearance
66     * @since 20
67     */
68    ALWAYS_DARK = 0,
69
70    /**
71     * Always display with light mode.
72     *
73     * @syscap SystemCapability.ArkUI.UiAppearance
74     * @systemapi hide this for inner system use
75     * @since 10
76     */
77    /**
78     * Always display with light mode.
79     *
80     * @syscap SystemCapability.ArkUI.UiAppearance
81     * @since 20
82     */
83    ALWAYS_LIGHT = 1
84  }
85
86  /**
87   * Set the system dark-mode.
88   *
89   * @permission ohos.permission.UPDATE_CONFIGURATION
90   * @param { DarkMode } mode - indicates the dark-mode to set
91   * @param { AsyncCallback<void> } callback - the callback of setDarkMode
92   * @throws { BusinessError } 201 - Permission denied.
93   * @throws { BusinessError } 401 - Parameter error. Possible causes:
94   * <br> 1. Mandatory parameters are left unspecified.
95   * <br> 2. Incorrect parameters types.
96   * <br> 3. Parameter verification failed.
97   * @throws { BusinessError } 500001 - Internal error.
98   * @syscap SystemCapability.ArkUI.UiAppearance
99   * @systemapi hide this for inner system use
100   * @since 10
101   */
102  function setDarkMode(mode: DarkMode, callback: AsyncCallback<void>): void;
103
104  /**
105   * Set the system dark-mode.
106   *
107   * @permission ohos.permission.UPDATE_CONFIGURATION
108   * @param { DarkMode } mode - indicates the dark-mode to set
109   * @returns { Promise<void> } the promise returned by the function
110   * @throws { BusinessError } 201 - Permission denied.
111   * @throws { BusinessError } 401 - Parameter error. Possible causes:
112   * <br> 1. Mandatory parameters are left unspecified.
113   * <br> 2. Incorrect parameters types.
114   * <br> 3. Parameter verification failed.
115   * @throws { BusinessError } 500001 - Internal error.
116   * @syscap SystemCapability.ArkUI.UiAppearance
117   * @systemapi hide this for inner system use
118   * @since 10
119   */
120  function setDarkMode(mode: DarkMode): Promise<void>;
121
122  /**
123   * Acquire the current dark-mode.
124   *
125   * @permission ohos.permission.UPDATE_CONFIGURATION
126   * @returns { DarkMode } current dark-mode.
127   * @throws { BusinessError } 201 - Permission denied.
128   * @throws { BusinessError } 401 - Parameter error. Possible causes:
129   * <br> 1. Mandatory parameters are left unspecified.
130   * <br> 2. Incorrect parameters types.
131   * <br> 3. Parameter verification failed.
132   * @throws { BusinessError } 500001 - Internal error.
133   * @syscap SystemCapability.ArkUI.UiAppearance
134   * @systemapi hide this for inner system use
135   * @since 10
136   */
137  /**
138   * Acquire the current dark-mode.
139   *
140   * @returns { DarkMode } current dark-mode.
141   * @throws { BusinessError } 500001 - Internal error.
142   * @syscap SystemCapability.ArkUI.UiAppearance
143   * @since 20
144   */
145  function getDarkMode(): DarkMode;
146
147  /**
148   * Set the system font-scale.
149   *
150   * @permission ohos.permission.UPDATE_CONFIGURATION
151   * @param { number } fontScale - indicates the font-scale to set
152   * @returns { Promise<void> } the promise returned by the function
153   * @throws { BusinessError } 201 - Permission denied.
154   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
155   * @throws { BusinessError } 401 - Parameter error. Possible causes:
156   * <br> 1. Mandatory parameters are left unspecified.
157   * <br> 2. Incorrect parameters types.
158   * <br> 3. Parameter verification failed.
159   * @throws { BusinessError } 500001 - Internal error.
160   * @syscap SystemCapability.ArkUI.UiAppearance
161   * @systemapi hide this for inner system use
162   * @since 12
163   */
164  function setFontScale(fontScale: number): Promise<void>;
165
166  /**
167   * Acquire the current font-scale.
168   *
169   * @permission ohos.permission.UPDATE_CONFIGURATION
170   * @returns { number } current font-scale.
171   * @throws { BusinessError } 201 - Permission denied.
172   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
173   * @throws { BusinessError } 401 - Parameter error. Possible causes:
174   * <br> 1. Mandatory parameters are left unspecified.
175   * <br> 2. Incorrect parameters types.
176   * <br> 3. Parameter verification failed.
177   * @throws { BusinessError } 500001 - Internal error.
178   * @syscap SystemCapability.ArkUI.UiAppearance
179   * @systemapi hide this for inner system use
180   * @since 12
181   */
182  /**
183   * Acquire the current font-scale.
184   *
185   * @returns { number } current font-scale.
186   * @throws { BusinessError } 500001 - Internal error.
187   * @syscap SystemCapability.ArkUI.UiAppearance
188   * @since 20
189   */
190  function getFontScale(): number;
191
192  /**
193   * Set the system font-weight-scale.
194   *
195   * @permission ohos.permission.UPDATE_CONFIGURATION
196   * @param { number } fontWeightScale - indicates the font-weight-scale to set
197   * @returns { Promise<void> } the promise returned by the function
198   * @throws { BusinessError } 201 - Permission denied.
199   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
200   * @throws { BusinessError } 401 - Parameter error. Possible causes:
201   * <br> 1. Mandatory parameters are left unspecified.
202   * <br> 2. Incorrect parameters types.
203   * <br> 3. Parameter verification failed.
204   * @throws { BusinessError } 500001 - Internal error.
205   * @syscap SystemCapability.ArkUI.UiAppearance
206   * @systemapi hide this for inner system use
207   * @since 12
208   */
209  function setFontWeightScale(fontWeightScale: number): Promise<void>;
210
211  /**
212   * Acquire the current font-weight-scale.
213   *
214   * @permission ohos.permission.UPDATE_CONFIGURATION
215   * @returns { number } current font-weight-scale.
216   * @throws { BusinessError } 201 - Permission denied.
217   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
218   * @throws { BusinessError } 401 - Parameter error. Possible causes:
219   * <br> 1. Mandatory parameters are left unspecified.
220   * <br> 2. Incorrect parameters types.
221   * <br> 3. Parameter verification failed.
222   * @throws { BusinessError } 500001 - Internal error.
223   * @syscap SystemCapability.ArkUI.UiAppearance
224   * @systemapi hide this for inner system use
225   * @since 12
226   */
227  /**
228   * Acquire the current font-weight-scale.
229   *
230   * @returns { number } current font-weight-scale.
231   * @throws { BusinessError } 500001 - Internal error.
232   * @syscap SystemCapability.ArkUI.UiAppearance
233   * @since 20
234   */
235  function getFontWeightScale(): number;
236}
237export default uiAppearance;
238