diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 1e54b4855892e964dd3445764e0b5abc39c66d3b..1e80c3d5acaa2cb348f26fcbefb01ad4b3d9e50f 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -173,6 +173,7 @@ - [@ohos.promptAction (Prompt)](js-apis-promptAction.md) - [@ohos.router (Page Routing)](js-apis-router.md) - [@ohos.measure (Text Measurement)](js-apis-measure.md) + - [@ohos.uiAppearance (UI Appearance)](js-apis-uiappearance.md) - Graphics - [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md) @@ -238,7 +239,7 @@ - [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md) - [@ohos.file.fs (File Management)](js-apis-file-fs.md) - [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md) - - [@ohos.file.picker (File Picker)](js-apis-file-picker.md) + - [@ohos.file.picker (Picker)](js-apis-file-picker.md) - [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md) - [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md) - [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md) @@ -266,6 +267,7 @@ - [@ohos.request (Upload and Download)](js-apis-request.md) - Connectivity + - [@ohos.bluetooth (Bluetooth) (To Be Deprecated Soon)](js-apis-bluetooth.md) - [@ohos.bluetoothManager (Bluetooth)(js-apis-bluetoothManager.md) - [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md) - [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md) @@ -340,7 +342,7 @@ - [@ohos.systemParameterEnhance (System Parameter)](js-apis-system-parameterEnhance.md) - [@ohos.thermal (Thermal Management)](js-apis-thermal.md) - [@ohos.update (Update)](js-apis-update.md) - - [@ohos.usbManager (USB Management)](js-apis-usbManager.md) + - [@ohos.usbManager (USB Manager)](js-apis-usbManager.md) - [@ohos.vibrator (Vibrator)](js-apis-vibrator.md) - Account Management @@ -390,7 +392,6 @@ - APIs No Longer Maintained - [@ohos.backgroundTaskManager (Background Task Management)](js-apis-backgroundTaskManager.md) - - [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md) - [@ohos.bundle (Bundle)](js-apis-Bundle.md) - [@ohos.bundle.innerBundleManager (innerBundleManager)](js-apis-Bundle-InnerBundleManager.md) - [@ohos.bundleState (Device Usage Statistics)](js-apis-deviceUsageStatistics.md) diff --git a/en/application-dev/reference/apis/js-apis-uiappearance.md b/en/application-dev/reference/apis/js-apis-uiappearance.md new file mode 100644 index 0000000000000000000000000000000000000000..3bac964627675b3475e273551d06b146636b410d --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-uiappearance.md @@ -0,0 +1,106 @@ +# UI Appearance + +The **uiAppearance** module provides basic capabilities for managing the system appearance. It allows for color mode configuration currently, and will introduce more features over time. + +> **NOTE** +> +> The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + + +## Modules to Import + +```ts +import uiAppearance from '@ohos.uiAppearance' +``` + + +## DarkMode + +Enumerates the color modes. + + +**System capability**: SystemCapability.ArkUI.UiAppearance + +| Name| Value| Description| +| -- | -- | -- | +| ALWAYS_DARK | 0 | The system is always in dark mode. | +| ALWAYS_LIGHT | 1 | The system is always in light mode.| + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode, callback: AsyncCallback\): void + +Sets the system color mode. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| +| callback | AsyncCallback\| Yes| Callback used to return the result.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); +}) + ``` + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode): Promise\; + +Sets the system color mode. This API uses a promise to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| + +**Return value** + +| Type | Description | +| ------ | ------------------------------ | +| Promise\ | Promise that returns no value.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.log('Set dark-mode successfully.'); +}).catch((err) => { + console.log(`Set dark-mode failed, ${err}`); +}); + ``` + + +## uiAppearance.getDarkMode + +getDarkMode(): DarkMode; + +Obtains the system color mode. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Return value** +| Type| Description| +| -- | -- | +|[DarkMode](#darkmode) | Color mode obtained.| + +**Example** + ```ts +let darkMode = uiAppearance.getDarkMode(); +console.log(`Get dark-mode ${darkMode}`); + ```