1# @ohos.application.Configuration (Configuration) 2 3The **Configuration** module defines environment change information. **Configuration** is an interface definition and is used only for field declaration. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead. 9 10## Modules to Import 11 12```ts 13import Configuration from '@ohos.app.application.Configuration'; 14``` 15 16**System capability**: SystemCapability.Ability.AbilityBase 17 18 | Name| Type| Readable| Writable| Description| 19| -------- | -------- | -------- | -------- | -------- | 20| language<sup>8+</sup> | string | Yes| Yes| Language of the application.| 21| colorMode<sup>8+</sup> | [ColorMode](js-apis-application-configurationConstant.md#configurationconstantcolormode) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| 22 23For details about the fields, see the **ohos.application.Configuration.d.ts** file. 24 25**Example** 26 27 ```ts 28import Ability from '@ohos.app.ability.UIAbility'; 29import Window from '@ohos.window' 30 31export default class MainAbility extends Ability { 32 onCreate(want, launchParam) { 33 } 34 35 onDestroy() { 36 } 37 38 onWindowStageCreate(windowStage: Window.WindowStage) { 39 let envCallback = { 40 onConfigurationUpdated(config) { 41 console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); 42 let language = config.language; 43 let colorMode = config.colorMode; 44 }, 45 onMemoryLevel(level){ 46 console.log('onMemoryLevel level: ${JSON.stringify(level)}'); 47 } 48 }; 49 50 let applicationContext = this.context.getApplicationContext(); 51 applicationContext.on('environment',envCallback); 52 53 windowStage.loadContent('pages/index', (err, data) => { 54 if (err.code) { 55 console.error('failed to load the content, error: + ${JSON.stringify(err)}'); 56 return; 57 } 58 console.info('Succeeded in loading the content, data: + ${JSON.stringify(data)}'); 59 }); 60 } 61} 62 ``` 63