• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.accessibility.config (SystemAPI)
2
3The **accessibility.config** module provides APIs for configuring system accessibility features, including accessibility extension, high-contrast text, mouse buttons, and captions.
4
5> **NOTE**
6>
7> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8> - The APIs provided by this module are system APIs.
9
10## Modules to Import
11
12```ts
13import { config } from '@kit.AccessibilityKit';
14```
15
16## Attributes
17
18**System capability**: SystemCapability.BarrierFree.Accessibility.Core
19
20| Name                                | Type                                                                                        | Readable| Writable| Description                                                       |
21|------------------------------------|--------------------------------------------------------------------------------------------| -------- | -------- |-----------------------------------------------------------|
22| highContrastText                   | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable high-contrast text. The value **true** indicates that high-contrast text is enabled, and **false** indicates the opposite.<br>Default value: **false**.                                          |
23| invertColor                        | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable color inversion. The value **true** indicates that color inversion is enabled, and **false** indicates the opposite.<br>Default value: **false**.                                            |
24| daltonizationState<sup>11+</sup>   | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable daltonization. It must be used with **daltonizationColorFilter**. The value **true** indicates that daltonization is enabled, and **false** indicates the opposite.<br>Default value: **false**.               |
25| daltonizationColorFilter           | [Config](#config)&lt;[DaltonizationColorFilter](#daltonizationcolorfilter)&gt;             | Yes| Yes| Configuration of the daltonization filter.                                              |
26| contentTimeout                     | [Config](#config)\<number>                                                                 | Yes| Yes| Recommended duration for content display. The value ranges from 0 to 5000, in milliseconds. Default value: **0**.                            |
27| animationOff                       | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to disable animation. The value **true** indicates that animation is disabled, and **false** indicates the opposite.<br>Default value: **0**.                                            |
28| brightnessDiscount                 | [Config](#config)\<number>                                                                 | Yes| Yes| Brightness discount. The value ranges from 0 to 1.0. Default value: **0.0**.                                     |
29| mouseKey                           | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable the mouse button. The value **true** indicates that the mouse button is enabled, and **false** indicates the opposite. <br>Default value: **0**.                                             |
30| mouseAutoClick                     | [Config](#config)\<number>                                                                 | Yes| Yes| Configuration of the automatic mouse click operation. The value ranges from 0 to 5000, in milliseconds. The value **0** indicates that the automatic mouse click is not triggered; other values indicate that the operation is triggered when the mouse pointer is hovered for a specified period of time.<br>Default value: **0**.               |
31| shortkey                           | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable the accessibility extension shortcut key. The value **true** indicates that the auxiliary extension shortcut key is enabled, and **false** indicates the opposite.<br>Default value: **false**.                                         |
32| shortkeyTarget                     | [Config](#config)\<string>                                                                 | Yes| Yes| Target application for the accessibility extension shortcut key. The value format is 'bundleName/abilityName'.  |
33| captions                           | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable captions. The value **true** indicates that caption is enabled, and **false** indicates the opposite.<br>Default value: **false**.                                            |
34| captionsStyle                      | [Config](#config)\<[accessibility.CaptionsStyle](js-apis-accessibility.md#captionsstyle8)> | Yes| Yes| Captions style.                                               |
35| audioMono<sup>10+</sup>            | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to enable mono audio. The value **true** indicates that mono audio is enabled, and **false** indicates the opposite.<br>Default value: **false**.                                           |
36| audioBalance<sup>10+</sup>         | [Config](#config)\<number>                                                                 | Yes| Yes| Audio balance for the left and right audio channels. The value ranges from -1.0 to 1.0. Default value: **0.0**.                               |
37| shortkeyMultiTargets<sup>11+</sup> | [Config](#config)&lt;Array\<string>&gt;                                                    | Yes| Yes| List of target applications for the accessibility shortcut keys. The value format is ['bundleName/abilityName'].|
38| clickResponseTime<sup>11+</sup>    | [Config](#config)&lt;[ClickResponseTime](#clickresponsetime11)&gt;                         | Yes| Yes| Length of time required for a click.                                            |
39| ignoreRepeatClick<sup>11+</sup>    | [Config](#config)\<boolean>                                                                | Yes| Yes| Whether to ignore repeated clicks. This parameter must be used together with **repeatClickInterval**. The value **true** indicates that the feature of ignoring repeated clicks is enabled, and **false** indicates the opposite.<br>Default value: **false**.                  |
40| repeatClickInterval<sup>11+</sup>  | [Config](#config)&lt;[RepeatClickInterval](#repeatclickinterval11)&gt;                     | Yes| Yes| Interval between repeated clicks.                                            |
41
42For a boolean return value, **True** means that the feature is enabled, and **False** means the opposite.
43[]()
44## enableAbility
45
46enableAbility(name: string, capability: Array&lt;accessibility.Capability&gt;): Promise&lt;void&gt;;
47
48**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
49
50Enables an accessibility extension ability. This API uses a promise to return the result.
51
52**System capability**: SystemCapability.BarrierFree.Accessibility.Core
53
54**Parameters**
55
56| Name| Type                                                                          | Mandatory| Description|
57| -------- |------------------------------------------------------------------------------| -------- | -------- |
58| name | string                                                                       | Yes| Name of the accessibility extension ability. The format is 'bundleName/abilityName'.|
59| capability | Array&lt;[accessibility.Capability](js-apis-accessibility.md#capability)&gt; | Yes| Capability of the accessibility extension ability.|
60
61**Return value**
62
63| Type| Description|
64| -------- | -------- |
65| Promise\<void>| Promise that returns no value.|
66
67**Error codes**
68
69For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
70
71| Error Code| Error Message|
72| ------- | -------------------------------- |
73| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
74| 202 | Permission verification failed. A non-system application calls a system API. |
75| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
76| 9300001 | Invalid bundle name or ability name.  |
77| 9300002 | Target ability already enabled. |
78
79**Example**
80
81```ts
82import { accessibility, config } from '@kit.AccessibilityKit';
83import { BusinessError } from '@kit.BasicServicesKit';
84
85let name: string = 'com.ohos.example/axExtension';
86let capability: accessibility.Capability[] = ['retrieve'];
87
88config.enableAbility(name, capability).then(() => {
89  console.info(`Succeeded  in enable ability, name is ${name}, capability is ${capability}`);
90}).catch((err: BusinessError) => {
91  console.error(`failed to enable ability, Code is ${err.code}, message is ${err.message}`);
92});
93```
94
95## enableAbility
96
97enableAbility(name: string, capability: Array&lt;[accessibility.Capability](js-apis-accessibility.md#capability)&gt;, callback: AsyncCallback&lt;void&gt;): void;
98
99**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
100
101Enables an accessibility extension ability. This API uses an asynchronous callback to return the result.
102
103**System capability**: SystemCapability.BarrierFree.Accessibility.Core
104
105**Parameters**
106
107| Name| Type                                                                             | Mandatory| Description|
108| -------- |---------------------------------------------------------------------------------| -------- | -------- |
109| name | string                                                                          | Yes| Name of the accessibility extension ability. The format is 'bundleName/abilityName'.|
110| capability | Array&lt;[accessibility.Capability](js-apis-accessibility.md#capability)&gt; | Yes| Capability of the accessibility extension ability.|
111| callback | AsyncCallback&lt;void&gt;                                                       | Yes| Callback used to return the result.|
112
113**Error codes**
114
115For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
116
117| Error Code| Error Message|
118| ------- | -------------------------------- |
119| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
120| 202 | Permission verification failed. A non-system application calls a system API. |
121| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
122| 9300001 | Invalid bundle name or ability name.  |
123| 9300002 | Target ability already enabled. |
124
125**Example**
126
127```ts
128import { accessibility, config } from '@kit.AccessibilityKit';
129import { BusinessError } from '@kit.BasicServicesKit';
130
131let name: string = 'com.ohos.example/axExtension';
132let capability: accessibility.Capability[] = ['retrieve'];
133
134config.enableAbility(name, capability, (err: BusinessError) => {
135  if (err) {
136    console.error(`failed to enable ability, Code is ${err.code}, message is ${err.message}`);
137    return;
138  }
139  console.info(`Succeeded in enable ability, name is ${name}, capability is ${capability}`);
140});
141```
142
143## disableAbility
144
145disableAbility(name: string): Promise&lt;void&gt;;
146
147**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
148
149Disables an accessibility extension ability. This API uses a promise to return the result.
150
151**System capability**: SystemCapability.BarrierFree.Accessibility.Core
152
153**Parameters**
154
155| Name| Type| Mandatory| Description|
156| -------- | -------- | -------- | -------- |
157| name | string | Yes| Name of the accessibility extension ability. The format is 'bundleName/abilityName'.|
158
159**Return value**
160
161| Type| Description|
162| -------- | -------- |
163| Promise\<void>| Promise that returns no value.|
164
165**Error codes**
166
167For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
168
169| Error Code| Error Message|
170| ------- | -------------------------------- |
171| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
172| 202 | Permission verification failed. A non-system application calls a system API. |
173| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
174| 9300001 | Invalid bundle name or ability name.  |
175
176**Example**
177
178```ts
179import { accessibility, config } from '@kit.AccessibilityKit';
180import { BusinessError } from '@kit.BasicServicesKit';
181
182let name: string = 'com.ohos.example/axExtension';
183
184config.disableAbility(name).then(() => {
185  console.info(`Succeeded in disable ability, name is ${name}`);
186}).catch((err: BusinessError) => {
187  console.error(`failed to disable ability, Code is ${err.code}, message is ${err.message}`);
188})
189```
190
191## disableAbility
192
193disableAbility(name: string, callback: AsyncCallback&lt;void&gt;): void;
194
195**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
196
197Disables an accessibility extension ability. This API uses an asynchronous callback to return the result.
198
199**System capability**: SystemCapability.BarrierFree.Accessibility.Core
200
201**Parameters**
202
203| Name| Type| Mandatory| Description|
204| -------- | -------- | -------- | -------- |
205| name | string | Yes| Name of the accessibility extension ability. The format is 'bundleName/abilityName'.|
206| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
207
208**Error codes**
209
210For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
211
212| Error Code| Error Message|
213| ------- | -------------------------------- |
214| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
215| 202 | Permission verification failed. A non-system application calls a system API. |
216| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
217| 9300001 | Invalid bundle name or ability name.  |
218
219**Example**
220
221```ts
222import { accessibility, config } from '@kit.AccessibilityKit';
223import { BusinessError } from '@kit.BasicServicesKit';
224
225let name: string = 'com.ohos.example/axExtension';
226
227config.disableAbility(name, (err: BusinessError) => {
228  if (err) {
229    console.error(`failed to enable ability, Code is ${err.code}, message is ${err.message}`);
230    return;
231  }
232  console.info(`Succeeded in disable, name is ${name}`);
233});
234```
235
236## on('enabledAccessibilityExtensionListChange')
237
238on(type: 'enabledAccessibilityExtensionListChange', callback: Callback&lt;void&gt;): void;
239
240**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
241
242Adds a listener for changes in the list of enabled accessibility extension abilities. This API uses an asynchronous callback to return the result.
243
244**System capability**: SystemCapability.BarrierFree.Accessibility.Core
245
246**Parameters**
247
248| Name| Type| Mandatory| Description|
249| -------- | -------- | -------- | -------- |
250| type | string | Yes| Listening type. The value is fixed at **'enabledAccessibilityExtensionListChange'**, indicating listening for changes in the list of enabled accessibility extension abilities.|
251| callback | Callback&lt;void&gt; | Yes| Callback invoked when the list of enabled accessibility extension abilities changes.|
252
253**Error codes**
254
255For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
256
257| Error Code| Error Message|
258| ------- | -------------------------------- |
259| 201  | Permission verification failed. The application does not have the permission required to call the API.  |
260| 202 | Permission verification failed. A non-system application calls a system API. |
261| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
262
263**Example**
264
265```ts
266import { config } from '@kit.AccessibilityKit';
267
268config.on('enabledAccessibilityExtensionListChange', () => {
269  console.info('subscribe enabled accessibility extension list change state success');
270});
271```
272
273## off('enabledAccessibilityExtensionListChange')
274
275off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback&lt;void&gt;): void;
276
277**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
278
279Cancels a listener for changes in the list of enabled accessibility extension abilities. This API uses an asynchronous callback to return the result.
280
281**System capability**: SystemCapability.BarrierFree.Accessibility.Core
282
283**Parameters**
284
285| Name| Type| Mandatory| Description|
286| -------- | -------- | -------- | -------- |
287| type |  string | Yes| Listening type. The value is fixed at **'enabledAccessibilityExtensionListChange'**, indicating listening for changes in the list of enabled accessibility extension abilities.|
288| callback | Callback&lt;void&gt; | No| Callback for the event. The value must be the same as the value of **callback** in **on('enabledAccessibilityExtensionListChange')**. If this parameter is not specified, listening will be disabled for all callbacks corresponding to the specified type.|
289
290**Error codes**
291
292For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
293
294| Error Code| Error Message|
295| ------- | -------------------------------- |
296| 201  | Permission verification failed. The application does not have the permission required to call the API.  |
297| 202 | Permission verification failed. A non-system application calls a system API. |
298| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
299
300**Example**
301
302```ts
303import { config } from '@kit.AccessibilityKit';
304
305config.off('enabledAccessibilityExtensionListChange', () => {
306  console.info('Unsubscribe enabled accessibility extension list change state success');
307});
308```
309
310## on('installedAccessibilityListChange')<sup>12+</sup>
311
312on(type: 'installedAccessibilityListChange', callback: Callback&lt;void&gt;): void;
313
314**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
315
316Adds a listener for changes in the list of installed accessibility extension abilities. This API uses an asynchronous callback to return the result.
317
318**System capability**: SystemCapability.BarrierFree.Accessibility.Core
319
320**Parameters**
321
322| Name| Type| Mandatory| Description|
323| -------- | -------- | -------- | -------- |
324| type | string | Yes| Listening type. The value is fixed at 'installedAccessibilityListChange', indicating listening for changes in the list of enabled accessibility extension abilities.|
325| callback | Callback&lt;void&gt; | Yes| Callback invoked when the list of installed accessibility extension abilities changes.|
326
327**Error codes**
328
329For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
330
331| Error Code| Error Message|
332| ------- | -------------------------------- |
333| 201  | Permission verification failed. The application does not have the permission required to call the API.  |
334| 202 | Permission verification failed. A non-system application calls a system API. |
335| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
336
337**Example**
338
339```ts
340import { config } from '@kit.AccessibilityKit';
341
342config.on('installedAccessibilityListChange', () => {
343  console.info('subscribe installed accessibility extension list change state success');
344});
345```
346
347## off('installedAccessibilityListChange')<sup>12+</sup>
348
349off(type: 'installedAccessibilityListChange', callback?: Callback&lt;void&gt;): void;
350
351**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
352
353Cancels a listener for changes in the list of installed accessibility extension abilities. This API uses an asynchronous callback to return the result.
354
355**System capability**: SystemCapability.BarrierFree.Accessibility.Core
356
357**Parameters**
358
359| Name| Type| Mandatory| Description|
360| -------- | -------- | -------- | -------- |
361| type |  string | Yes| Listening type. The value is fixed at 'installedAccessibilityListChange', indicating listening for changes in the list of enabled accessibility extension abilities.|
362| callback | Callback&lt;void&gt; | No| Callback for the event. The value must be the same as the value of **callback** in **on('installedAccessibilityListChange')**. If this parameter is not specified, listening will be disabled for all callbacks corresponding to the specified type.|
363
364**Error codes**
365
366For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
367
368| Error Code| Error Message|
369| ------- | -------------------------------- |
370| 201  | Permission verification failed. The application does not have the permission required to call the API.  |
371| 202 | Permission verification failed. A non-system application calls a system API. |
372| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
373
374**Example**
375
376```ts
377import { config } from '@kit.AccessibilityKit';
378
379config.off('installedAccessibilityListChange', () => {
380  console.info('Unsubscribe installed accessibility extension list change state success');
381});
382```
383
384## Config
385
386Implements configuration, acquisition, and listening for attributes.
387
388### set
389
390set(value: T): Promise&lt;void&gt;;
391
392**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
393
394Sets the attribute value. This API uses a promise to return the result.
395
396**System capability**: SystemCapability.BarrierFree.Accessibility.Core
397
398**Parameters**
399
400| Name| Type| Mandatory| Description|
401| -------- | -------- | -------- | -------- |
402| value | T | Yes| Attribute value to set.|
403
404**Return value**
405
406| Type| Description|
407| -------- | -------- |
408| Promise\<void>| Promise that returns no value.|
409
410**Error codes**
411
412For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
413
414| Error Code| Error Message|
415| ------- | -------------------------------- |
416| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
417| 202 | Permission verification failed. A non-system application calls a system API. |
418| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
419
420**Example**
421
422```ts
423import { config } from '@kit.AccessibilityKit';
424import { BusinessError } from '@kit.BasicServicesKit';
425
426let value: boolean = true;
427
428config.highContrastText.set(value).then(() => {
429  console.info(`Succeeded in set highContrastText value is ${value}`);
430}).catch((err: BusinessError) => {
431  console.error(`failed to set highContrastText, Code is ${err.code}, message is ${err.message}`);
432});
433```
434
435### set
436
437set(value: T, callback: AsyncCallback&lt;void&gt;): void;
438
439**Required permissions**: ohos.permission.WRITE_ACCESSIBILITY_CONFIG
440
441Sets the attribute value. This API uses an asynchronous callback to return the result.
442
443**System capability**: SystemCapability.BarrierFree.Accessibility.Core
444
445**Parameters**
446
447| Name| Type| Mandatory| Description|
448| -------- | -------- | -------- | -------- |
449| value | T | Yes| Attribute value to set.|
450| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result.|
451
452**Error codes**
453
454For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
455
456| Error Code| Error Message|
457| ------- | -------------------------------- |
458| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
459| 202 | Permission verification failed. A non-system application calls a system API. |
460| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
461
462**Example**
463
464```ts
465import { config } from '@kit.AccessibilityKit';
466import { BusinessError } from '@kit.BasicServicesKit';
467
468let value: boolean = true;
469
470config.highContrastText.set(value, (err: BusinessError) => {
471  if (err) {
472    console.error(`failed to set highContrastText, Code is ${err.code}, message is ${err.message}`);
473    return;
474  }
475  console.info(`Succeeded in set highContrastText, value is ${value}`);
476});
477```
478
479### get
480
481get(): Promise&lt;T&gt;;
482
483Obtains the attribute value. This API uses a promise to return the result.
484
485**System capability**: SystemCapability.BarrierFree.Accessibility.Core
486
487**Return value**
488
489| Type| Description|
490| -------- | -------- |
491| Promise&lt;T&gt; | Promise used to return the value obtained.|
492
493**Error codes**
494
495For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
496
497| Error Code| Error Message|
498| ------- | -------------------------------- |
499| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
500| 202 | Permission verification failed. A non-system application calls a system API. |
501
502**Example**
503
504```ts
505import { config } from '@kit.AccessibilityKit';
506import { BusinessError } from '@kit.BasicServicesKit';
507
508config.highContrastText.get().then((data: boolean) => {
509  console.info(`Succeeded in get highContrastText, data is ${data}`);
510}).catch((err: BusinessError) => {
511  console.error(`failed to get highContrastText, Code is ${err.code}, message is ${err.message}`);
512});
513```
514
515### get
516
517get(callback: AsyncCallback&lt;T&gt;): void;
518
519Obtains the attribute value. This API uses an asynchronous callback to return the result.
520
521**System capability**: SystemCapability.BarrierFree.Accessibility.Core
522
523**Parameters**
524
525| Name| Type| Mandatory| Description|
526| -------- | -------- | -------- | -------- |
527| callback | AsyncCallback&lt;T&gt; | Yes| Callback used to return the attribute value.|
528
529**Error codes**
530
531For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
532
533| Error Code| Error Message|
534| ------- | -------------------------------- |
535| 202 | Permission verification failed. A non-system application calls a system API. |
536
537**Example**
538
539```ts
540import { config } from '@kit.AccessibilityKit';
541import { BusinessError } from '@kit.BasicServicesKit';
542
543config.highContrastText.get((err: BusinessError, data: boolean) => {
544  if (err) {
545    console.error(`failed to get highContrastText, Code is ${err.code}, message is ${err.message}`);
546    return;
547  }
548  console.info(`Succeeded in get highContrastText, data is ${data}`);
549});
550```
551
552### on
553
554on(callback: Callback&lt;T&gt;): void;
555
556**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
557
558Adds a listener for attribute changes. This API uses an asynchronous callback to return the result.
559
560**System capability**: SystemCapability.BarrierFree.Accessibility.Core
561
562**Parameters**
563
564| Name| Type| Mandatory| Description|
565| -------- | -------- | -------- | -------- |
566| callback | Callback&lt;T&gt; | Yes| Callback invoked when the attribute changes.|
567
568**Error codes**
569
570For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
571
572| Error Code| Error Message|
573| ------- | -------------------------------- |
574| 201 | Permission verification failed. The application does not have the permission required to call the API.  |
575| 202 | Permission verification failed. A non-system application calls a system API. |
576| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
577
578**Example**
579
580```ts
581import { config } from '@kit.AccessibilityKit';
582
583config.highContrastText.on((data: boolean) => {
584  console.info(`subscribe highContrastText success, result: ${JSON.stringify(data)}`);
585});
586```
587
588### off
589
590off(callback?: Callback&lt;T&gt;): void;
591
592**Required permissions**: ohos.permission.READ_ACCESSIBILITY_CONFIG
593
594Cancels the listener for attribute changes. This API uses an asynchronous callback to return the result.
595
596**System capability**: SystemCapability.BarrierFree.Accessibility.Core
597
598**Parameters**
599
600| Name| Type| Mandatory| Description|
601| -------- | -------- | -------- | -------- |
602| callback | Callback&lt;T&gt; | No| Callback for the event. The value must be the same as the value of **callback** in **on()**. If this parameter is not specified, listening will be disabled for all callbacks corresponding to the specified type.|
603
604**Error codes**
605
606For details about the error codes, see [Accessibility Error Codes](errorcode-accessibility.md).
607
608| Error Code| Error Message|
609| ------- | -------------------------------- |
610| 201  | Permission verification failed. The application does not have the permission required to call the API.  |
611| 202 | Permission verification failed. A non-system application calls a system API. |
612
613**Example**
614
615```ts
616import { config } from '@kit.AccessibilityKit';
617
618config.highContrastText.off((data: boolean) => {
619  console.info(`Unsubscribe highContrastText success, result: ${JSON.stringify(data)}`);
620});
621```
622
623## DaltonizationColorFilter
624
625Enumerates the daltonization filters.
626**DaltonizationColorFilter** takes effect only when the daltonization filter is enabled ([daltonizationState](#attributes) set to **true**).
627
628**System capability**: SystemCapability.BarrierFree.Accessibility.Core
629
630| Name| Description|
631| -------- | -------- |
632| Normal | Filter for normal users.|
633| Protanomaly | Filter for protanomaly.|
634| Deuteranomaly | Filter for deuteranomaly.|
635| Tritanomaly  | Filter for tritanomaly.|
636
637## ClickResponseTime<sup>11+</sup>
638
639Defines the length of time for a click.
640
641**System capability**: SystemCapability.BarrierFree.Accessibility.Core
642
643| Name         | Description        |
644|-------------|------------|
645| Short       | Short (default). |
646| Medium      | Medium.      |
647| Long        | Long.      |
648
649## RepeatClickInterval<sup>11+</sup>
650
651Defines the interval between repeated clicks.
652**RepeatClickInterval** takes effect only when repeated clicks are ignored ([ignoreRepeatClick](#attributes) set to **true**).
653
654**System capability**: SystemCapability.BarrierFree.Accessibility.Core
655
656| Name      | Description   |
657|----------|-------|
658| Shortest | Shortest.|
659| Short    | Short. |
660| Medium   | Medium. |
661| Long     | Long. |
662| Longest  | Longest.|
663