1 2/* 3 * Copyright (c) 2024 Huawei Device Co., Ltd. 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17/** 18 * @file 19 * @kit ArkUI 20 */ 21 22/*** if arkts 1.2 */ 23import { ResourceColor } from './arkui/component/units'; 24/*** endif */ 25 26/** 27 * Defines the struct of Theme. 28 * 29 * @interface Theme 30 * @syscap SystemCapability.ArkUI.ArkUI.Full 31 * @crossplatform 32 * @atomicservice 33 * @since arkts {'1.1':'12','1.2':'20'} 34 * @arkts 1.1&1.2 35 */ 36export declare interface Theme { 37 /** 38 * Define tokens associated with color resources. 39 * 40 * @type { Colors } 41 * @syscap SystemCapability.ArkUI.ArkUI.Full 42 * @crossplatform 43 * @atomicservice 44 * @since arkts {'1.1':'12','1.2':'20'} 45 * @arkts 1.1&1.2 46 */ 47 colors: Colors; 48} 49 50/** 51 * Defines the struct of Colors. 52 * 53 * @interface Colors 54 * @syscap SystemCapability.ArkUI.ArkUI.Full 55 * @crossplatform 56 * @atomicservice 57 * @since arkts {'1.1':'12','1.2':'20'} 58 * @arkts 1.1&1.2 59 */ 60export declare interface Colors { 61 62 /** 63 * System brand Color. 64 * 65 * @type { ResourceColor } 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @crossplatform 68 * @atomicservice 69 * @since arkts {'1.1':'12','1.2':'20'} 70 * @arkts 1.1&1.2 71 */ 72 brand: ResourceColor; 73 74 /** 75 * System warning Color. 76 * 77 * @type { ResourceColor } 78 * @syscap SystemCapability.ArkUI.ArkUI.Full 79 * @crossplatform 80 * @atomicservice 81 * @since arkts {'1.1':'12','1.2':'20'} 82 * @arkts 1.1&1.2 83 */ 84 warning: ResourceColor; 85 86 /** 87 * System alert Color. 88 * 89 * @type { ResourceColor } 90 * @syscap SystemCapability.ArkUI.ArkUI.Full 91 * @crossplatform 92 * @atomicservice 93 * @since arkts {'1.1':'12','1.2':'20'} 94 * @arkts 1.1&1.2 95 */ 96 alert: ResourceColor; 97 98 /** 99 * System confirm Color. 100 * 101 * @type { ResourceColor } 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @crossplatform 104 * @atomicservice 105 * @since arkts {'1.1':'12','1.2':'20'} 106 * @arkts 1.1&1.2 107 */ 108 confirm: ResourceColor; 109 110 /** 111 * First level text color. 112 * 113 * @type { ResourceColor } 114 * @syscap SystemCapability.ArkUI.ArkUI.Full 115 * @crossplatform 116 * @atomicservice 117 * @since arkts {'1.1':'12','1.2':'20'} 118 * @arkts 1.1&1.2 119 */ 120 fontPrimary: ResourceColor; 121 122 /** 123 * Secondary text color. 124 * 125 * @type { ResourceColor } 126 * @syscap SystemCapability.ArkUI.ArkUI.Full 127 * @crossplatform 128 * @atomicservice 129 * @since arkts {'1.1':'12','1.2':'20'} 130 * @arkts 1.1&1.2 131 */ 132 fontSecondary: ResourceColor; 133 134 /** 135 * tertiary text color. 136 * 137 * @type { ResourceColor } 138 * @syscap SystemCapability.ArkUI.ArkUI.Full 139 * @crossplatform 140 * @atomicservice 141 * @since arkts {'1.1':'12','1.2':'20'} 142 * @arkts 1.1&1.2 143 */ 144 fontTertiary: ResourceColor; 145 146 /** 147 * Fourth text color. 148 * 149 * @type { ResourceColor } 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @atomicservice 153 * @since arkts {'1.1':'12','1.2':'20'} 154 * @arkts 1.1&1.2 155 */ 156 fontFourth: ResourceColor; 157 158 /** 159 * Emphasize text color. 160 * 161 * @type { ResourceColor } 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @crossplatform 164 * @atomicservice 165 * @since arkts {'1.1':'12','1.2':'20'} 166 * @arkts 1.1&1.2 167 */ 168 fontEmphasize: ResourceColor; 169 170 /** 171 * First level text inversion, used on colored backgrounds. 172 * 173 * @type { ResourceColor } 174 * @syscap SystemCapability.ArkUI.ArkUI.Full 175 * @crossplatform 176 * @atomicservice 177 * @since arkts {'1.1':'12','1.2':'20'} 178 * @arkts 1.1&1.2 179 */ 180 fontOnPrimary: ResourceColor; 181 182 /** 183 * Secondary level text inversion, used on colored backgrounds. 184 * 185 * @type { ResourceColor } 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @atomicservice 189 * @since arkts {'1.1':'12','1.2':'20'} 190 * @arkts 1.1&1.2 191 */ 192 fontOnSecondary: ResourceColor; 193 194 /** 195 * Tertiary level text inversion, used on colored backgrounds. 196 * 197 * @type { ResourceColor } 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @crossplatform 200 * @atomicservice 201 * @since arkts {'1.1':'12','1.2':'20'} 202 * @arkts 1.1&1.2 203 */ 204 fontOnTertiary: ResourceColor; 205 206 /** 207 * Fourth level text inversion, used on colored backgrounds. 208 * 209 * @type { ResourceColor } 210 * @syscap SystemCapability.ArkUI.ArkUI.Full 211 * @crossplatform 212 * @atomicservice 213 * @since arkts {'1.1':'12','1.2':'20'} 214 * @arkts 1.1&1.2 215 */ 216 fontOnFourth: ResourceColor; 217 218 /** 219 * First level icon color. 220 * 221 * @type { ResourceColor } 222 * @syscap SystemCapability.ArkUI.ArkUI.Full 223 * @crossplatform 224 * @atomicservice 225 * @since arkts {'1.1':'12','1.2':'20'} 226 * @arkts 1.1&1.2 227 */ 228 iconPrimary: ResourceColor; 229 230 /** 231 * Secondary level icon color. 232 * 233 * @type { ResourceColor } 234 * @syscap SystemCapability.ArkUI.ArkUI.Full 235 * @crossplatform 236 * @atomicservice 237 * @since arkts {'1.1':'12','1.2':'20'} 238 * @arkts 1.1&1.2 239 */ 240 iconSecondary: ResourceColor; 241 242 /** 243 * Tertiary level icon color. 244 * 245 * @type { ResourceColor } 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @crossplatform 248 * @atomicservice 249 * @since arkts {'1.1':'12','1.2':'20'} 250 * @arkts 1.1&1.2 251 */ 252 iconTertiary: ResourceColor; 253 254 /** 255 * Fourth level icon color. 256 * 257 * @type { ResourceColor } 258 * @syscap SystemCapability.ArkUI.ArkUI.Full 259 * @crossplatform 260 * @atomicservice 261 * @since arkts {'1.1':'12','1.2':'20'} 262 * @arkts 1.1&1.2 263 */ 264 iconFourth: ResourceColor; 265 266 /** 267 * Emphasize level icon color. 268 * 269 * @type { ResourceColor } 270 * @syscap SystemCapability.ArkUI.ArkUI.Full 271 * @crossplatform 272 * @atomicservice 273 * @since arkts {'1.1':'12','1.2':'20'} 274 * @arkts 1.1&1.2 275 */ 276 iconEmphasize: ResourceColor; 277 278 /** 279 * Secondary emphasize level icon color. 280 * 281 * @type { ResourceColor } 282 * @syscap SystemCapability.ArkUI.ArkUI.Full 283 * @crossplatform 284 * @atomicservice 285 * @since arkts {'1.1':'12','1.2':'20'} 286 * @arkts 1.1&1.2 287 */ 288 iconSubEmphasize: ResourceColor; 289 290 /** 291 * First level icon reversed, used on a colored background. 292 * 293 * @type { ResourceColor } 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @crossplatform 296 * @atomicservice 297 * @since arkts {'1.1':'12','1.2':'20'} 298 * @arkts 1.1&1.2 299 */ 300 iconOnPrimary: ResourceColor; 301 302 /** 303 * Secondary level icon reversed, used on a colored background. 304 * 305 * @type { ResourceColor } 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @atomicservice 309 * @since arkts {'1.1':'12','1.2':'20'} 310 * @arkts 1.1&1.2 311 */ 312 iconOnSecondary: ResourceColor; 313 314 /** 315 * Tertiary level icon reversed, used on a colored background. 316 * 317 * @type { ResourceColor } 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @crossplatform 320 * @atomicservice 321 * @since arkts {'1.1':'12','1.2':'20'} 322 * @arkts 1.1&1.2 323 */ 324 iconOnTertiary: ResourceColor; 325 326 /** 327 * Fourth level icon reversed, used on a colored background. 328 * 329 * @type { ResourceColor } 330 * @syscap SystemCapability.ArkUI.ArkUI.Full 331 * @crossplatform 332 * @atomicservice 333 * @since arkts {'1.1':'12','1.2':'20'} 334 * @arkts 1.1&1.2 335 */ 336 iconOnFourth: ResourceColor; 337 338 /** 339 * System Primary level background color. 340 * 341 * @type { ResourceColor } 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @crossplatform 344 * @atomicservice 345 * @since arkts {'1.1':'12','1.2':'20'} 346 * @arkts 1.1&1.2 347 */ 348 backgroundPrimary: ResourceColor; 349 350 /** 351 * System Secondary level background color. 352 * 353 * @type { ResourceColor } 354 * @syscap SystemCapability.ArkUI.ArkUI.Full 355 * @crossplatform 356 * @atomicservice 357 * @since arkts {'1.1':'12','1.2':'20'} 358 * @arkts 1.1&1.2 359 */ 360 backgroundSecondary: ResourceColor; 361 362 /** 363 * System tertiary level background color. 364 * 365 * @type { ResourceColor } 366 * @syscap SystemCapability.ArkUI.ArkUI.Full 367 * @crossplatform 368 * @atomicservice 369 * @since arkts {'1.1':'12','1.2':'20'} 370 * @arkts 1.1&1.2 371 */ 372 backgroundTertiary: ResourceColor; 373 374 /** 375 * System fourth level background color. 376 * 377 * @type { ResourceColor } 378 * @syscap SystemCapability.ArkUI.ArkUI.Full 379 * @crossplatform 380 * @atomicservice 381 * @since arkts {'1.1':'12','1.2':'20'} 382 * @arkts 1.1&1.2 383 */ 384 backgroundFourth: ResourceColor; 385 386 /** 387 * System emphasize level background color. 388 * 389 * @type { ResourceColor } 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since arkts {'1.1':'12','1.2':'20'} 394 * @arkts 1.1&1.2 395 */ 396 backgroundEmphasize: ResourceColor; 397 398 /** 399 * CompForegroundPrimary color. 400 * 401 * @type { ResourceColor } 402 * @syscap SystemCapability.ArkUI.ArkUI.Full 403 * @crossplatform 404 * @atomicservice 405 * @since arkts {'1.1':'12','1.2':'20'} 406 * @arkts 1.1&1.2 407 */ 408 compForegroundPrimary: ResourceColor; 409 410 /** 411 * CompBackgroundPrimary color. 412 * 413 * @type { ResourceColor } 414 * @syscap SystemCapability.ArkUI.ArkUI.Full 415 * @crossplatform 416 * @atomicservice 417 * @since arkts {'1.1':'12','1.2':'20'} 418 * @arkts 1.1&1.2 419 */ 420 compBackgroundPrimary: ResourceColor; 421 422 /** 423 * CompBackgroundPrimaryTran color. 424 * 425 * @type { ResourceColor } 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @crossplatform 428 * @atomicservice 429 * @since arkts {'1.1':'12','1.2':'20'} 430 * @arkts 1.1&1.2 431 */ 432 compBackgroundPrimaryTran: ResourceColor; 433 434 /** 435 * CompBackgroundPrimaryContrary color. 436 * 437 * @type { ResourceColor } 438 * @syscap SystemCapability.ArkUI.ArkUI.Full 439 * @crossplatform 440 * @atomicservice 441 * @since arkts {'1.1':'12','1.2':'20'} 442 * @arkts 1.1&1.2 443 */ 444 compBackgroundPrimaryContrary: ResourceColor; 445 446 /** 447 * CompBackgroundGray color. 448 * 449 * @type { ResourceColor } 450 * @syscap SystemCapability.ArkUI.ArkUI.Full 451 * @crossplatform 452 * @atomicservice 453 * @since arkts {'1.1':'12','1.2':'20'} 454 * @arkts 1.1&1.2 455 */ 456 compBackgroundGray: ResourceColor; 457 458 /** 459 * 10% black universal control background. 460 * 461 * @type { ResourceColor } 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @crossplatform 464 * @atomicservice 465 * @since arkts {'1.1':'12','1.2':'20'} 466 * @arkts 1.1&1.2 467 */ 468 compBackgroundSecondary: ResourceColor; 469 470 /** 471 * 5% black universal control background. 472 * 473 * @type { ResourceColor } 474 * @syscap SystemCapability.ArkUI.ArkUI.Full 475 * @crossplatform 476 * @atomicservice 477 * @since arkts {'1.1':'12','1.2':'20'} 478 * @arkts 1.1&1.2 479 */ 480 compBackgroundTertiary: ResourceColor; 481 482 /** 483 * 100% bright brand background color. 484 * 485 * @type { ResourceColor } 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @crossplatform 488 * @atomicservice 489 * @since arkts {'1.1':'12','1.2':'20'} 490 * @arkts 1.1&1.2 491 */ 492 compBackgroundEmphasize: ResourceColor; 493 494 /** 495 * Black neutral high gloss color. 496 * 497 * @type { ResourceColor } 498 * @syscap SystemCapability.ArkUI.ArkUI.Full 499 * @crossplatform 500 * @atomicservice 501 * @since arkts {'1.1':'12','1.2':'20'} 502 * @arkts 1.1&1.2 503 */ 504 compBackgroundNeutral: ResourceColor; 505 506 /** 507 * 20% High gloss brand background color. 508 * 509 * @type { ResourceColor } 510 * @syscap SystemCapability.ArkUI.ArkUI.Full 511 * @crossplatform 512 * @atomicservice 513 * @since arkts {'1.1':'12','1.2':'20'} 514 * @arkts 1.1&1.2 515 */ 516 compEmphasizeSecondary: ResourceColor; 517 518 /** 519 * 10% High gloss brand background color. 520 * 521 * @type { ResourceColor } 522 * @syscap SystemCapability.ArkUI.ArkUI.Full 523 * @crossplatform 524 * @atomicservice 525 * @since arkts {'1.1':'12','1.2':'20'} 526 * @arkts 1.1&1.2 527 */ 528 compEmphasizeTertiary: ResourceColor; 529 530 /** 531 * Universal Division Line Color 532 * 533 * @type { ResourceColor } 534 * @syscap SystemCapability.ArkUI.ArkUI.Full 535 * @crossplatform 536 * @atomicservice 537 * @since arkts {'1.1':'12','1.2':'20'} 538 * @arkts 1.1&1.2 539 */ 540 compDivider: ResourceColor; 541 542 /** 543 * CompCommonContrary Color 544 * 545 * @type { ResourceColor } 546 * @syscap SystemCapability.ArkUI.ArkUI.Full 547 * @crossplatform 548 * @atomicservice 549 * @since arkts {'1.1':'12','1.2':'20'} 550 * @arkts 1.1&1.2 551 */ 552 compCommonContrary: ResourceColor; 553 554 /** 555 * CompBackgroundFocus Color 556 * 557 * @type { ResourceColor } 558 * @syscap SystemCapability.ArkUI.ArkUI.Full 559 * @crossplatform 560 * @atomicservice 561 * @since arkts {'1.1':'12','1.2':'20'} 562 * @arkts 1.1&1.2 563 */ 564 compBackgroundFocus: ResourceColor; 565 566 /** 567 * CompFocusedPrimary Color 568 * 569 * @type { ResourceColor } 570 * @syscap SystemCapability.ArkUI.ArkUI.Full 571 * @crossplatform 572 * @atomicservice 573 * @since arkts {'1.1':'12','1.2':'20'} 574 * @arkts 1.1&1.2 575 */ 576 compFocusedPrimary: ResourceColor; 577 578 /** 579 * CompFocusedSecondary Color 580 * 581 * @type { ResourceColor } 582 * @syscap SystemCapability.ArkUI.ArkUI.Full 583 * @crossplatform 584 * @atomicservice 585 * @since arkts {'1.1':'12','1.2':'20'} 586 * @arkts 1.1&1.2 587 */ 588 compFocusedSecondary: ResourceColor; 589 590 /** 591 * CompFocusedTertiary Color 592 * 593 * @type { ResourceColor } 594 * @syscap SystemCapability.ArkUI.ArkUI.Full 595 * @crossplatform 596 * @atomicservice 597 * @since arkts {'1.1':'12','1.2':'20'} 598 * @arkts 1.1&1.2 599 */ 600 compFocusedTertiary: ResourceColor; 601 602 /** 603 * Hover interactive color 604 * 605 * @type { ResourceColor } 606 * @syscap SystemCapability.ArkUI.ArkUI.Full 607 * @crossplatform 608 * @atomicservice 609 * @since arkts {'1.1':'12','1.2':'20'} 610 * @arkts 1.1&1.2 611 */ 612 interactiveHover: ResourceColor; 613 614 /** 615 * Pressed interactive color 616 * 617 * @type { ResourceColor } 618 * @syscap SystemCapability.ArkUI.ArkUI.Full 619 * @crossplatform 620 * @atomicservice 621 * @since arkts {'1.1':'12','1.2':'20'} 622 * @arkts 1.1&1.2 623 */ 624 interactivePressed: ResourceColor; 625 626 /** 627 * Focus interactive color 628 * 629 * @type { ResourceColor } 630 * @syscap SystemCapability.ArkUI.ArkUI.Full 631 * @crossplatform 632 * @atomicservice 633 * @since arkts {'1.1':'12','1.2':'20'} 634 * @arkts 1.1&1.2 635 */ 636 interactiveFocus: ResourceColor; 637 638 /** 639 * Active interactive color 640 * 641 * @type { ResourceColor } 642 * @syscap SystemCapability.ArkUI.ArkUI.Full 643 * @crossplatform 644 * @atomicservice 645 * @since arkts {'1.1':'12','1.2':'20'} 646 * @arkts 1.1&1.2 647 */ 648 interactiveActive: ResourceColor; 649 650 /** 651 * Select interactive color 652 * 653 * @type { ResourceColor } 654 * @syscap SystemCapability.ArkUI.ArkUI.Full 655 * @crossplatform 656 * @atomicservice 657 * @since arkts {'1.1':'12','1.2':'20'} 658 * @arkts 1.1&1.2 659 */ 660 interactiveSelect: ResourceColor; 661 662 /** 663 * Click interactive color 664 * 665 * @type { ResourceColor } 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @atomicservice 669 * @since arkts {'1.1':'12','1.2':'20'} 670 * @arkts 1.1&1.2 671 */ 672 interactiveClick: ResourceColor; 673} 674 675/** 676 * Defines the struct of CustomTheme. 677 * 678 * @interface CustomTheme 679 * @syscap SystemCapability.ArkUI.ArkUI.Full 680 * @crossplatform 681 * @atomicservice 682 * @since arkts {'1.1':'12','1.2':'20'} 683 * @arkts 1.1&1.2 684 */ 685export declare interface CustomTheme { 686 /** 687 * Define tokens associated with color resources.. 688 * 689 * @type { ?CustomColors } 690 * @syscap SystemCapability.ArkUI.ArkUI.Full 691 * @crossplatform 692 * @atomicservice 693 * @since arkts {'1.1':'12','1.2':'20'} 694 * @arkts 1.1&1.2 695 */ 696 colors?: CustomColors; 697 698 /** 699 * Define tokens associated with dark mode color resources. 700 * 701 * @type { ?CustomDarkColors } 702 * @default If not set darkColors, color value will same as colors under light mode and will not change with color 703 * mode, unless the color is setted by resource in dark directory. 704 * @syscap SystemCapability.ArkUI.ArkUI.Full 705 * @crossplatform 706 * @atomicservice 707 * @since 20 708 */ 709 darkColors?: CustomDarkColors; 710} 711 712/** 713 * Defines the struct of CustomColors. 714 * 715 * @typedef { Partial<Colors> } CustomColors 716 * @syscap SystemCapability.ArkUI.ArkUI.Full 717 * @crossplatform 718 * @atomicservice 719 * @since 12 720 */ 721export declare type CustomColors = Partial<Colors>; 722 723/** 724 * Defines the struct of CustomColors. 725 * 726 * @typedef { Partial<Colors> } CustomColors 727 * @syscap SystemCapability.ArkUI.ArkUI.Full 728 * @crossplatform 729 * @atomicservice 730 * @since 20 731 * @arkts 1.2 732 */ 733export type CustomColors = Partial<Colors>; 734 735/** 736 * Defines the struct of CustomDarkColors. 737 * 738 * @typedef { Partial<Colors> } CustomDarkColors 739 * @syscap SystemCapability.ArkUI.ArkUI.Full 740 * @crossplatform 741 * @atomicservice 742 * @since 20 743 */ 744export declare type CustomDarkColors = Partial<Colors>; 745 746/** 747 * Class ThemeControl provides the Theme management for whole Ability and pages. 748 * 749 * @syscap SystemCapability.ArkUI.ArkUI.Full 750 * @crossplatform 751 * @atomicservice 752 * @since arkts {'1.1':'12','1.2':'20'} 753 * @arkts 1.1&1.2 754 */ 755export declare class ThemeControl { 756 /** 757 * Sets the default Theme: 758 * - for whole Ability when invoked from the Ability level code. 759 * - for the ArkUI page and for later opened pages when invoked at the ArkUI page level. 760 * 761 * @param { CustomTheme } theme 762 * @syscap SystemCapability.ArkUI.ArkUI.Full 763 * @crossplatform 764 * @atomicservice 765 * @since arkts {'1.1':'12','1.2':'20'} 766 * @arkts 1.1&1.2 767 */ 768 static setDefaultTheme(theme: CustomTheme): void; 769} 770