interface_sdk-js/api/@ohos.arkui.theme.d.ts
guozonghao ccf0e7ce76 增加主题接口
Signed-off-by: guozonghao <guozonghao@huawei.com>
2024-05-09 20:16:22 +08:00

671 lines
14 KiB
TypeScript

/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit ArkUI
*/
/**
* Defines the struct of Theme.
*
* @interface Theme
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export declare interface Theme {
/**
* Define tokens associated with color resources.
*
* @type { Colors }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
colors: Colors;
}
/**
* Defines the struct of Colors.
*
* @interface Colors
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export declare interface Colors {
/**
* System brand Color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
brand: ResourceColor;
/**
* System warning Color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
warning: ResourceColor;
/**
* System alert Color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
alert: ResourceColor;
/**
* System confirm Color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
confirm: ResourceColor;
/**
* First level text color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontPrimary: ResourceColor;
/**
* Secondary text color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontSecondary: ResourceColor;
/**
* tertiary text color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontTertiary: ResourceColor;
/**
* Fourth text color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontFourth: ResourceColor;
/**
* Emphasize text color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontEmphasize: ResourceColor;
/**
* First level text inversion, used on colored backgrounds.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontOnPrimary: ResourceColor;
/**
* Secondary level text inversion, used on colored backgrounds.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontOnSecondary: ResourceColor;
/**
* Tertiary level text inversion, used on colored backgrounds.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontOnTertiary: ResourceColor;
/**
* Fourth level text inversion, used on colored backgrounds.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontOnFourth: ResourceColor;
/**
* First level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconPrimary: ResourceColor;
/**
* Secondary level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconSecondary: ResourceColor;
/**
* Tertiary level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconTertiary: ResourceColor;
/**
* Fourth level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconFourth: ResourceColor;
/**
* Emphasize level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconEmphasize: ResourceColor;
/**
* Secondary emphasize level icon color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconSubEmphasize: ResourceColor;
/**
* First level icon reversed, used on a colored background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconOnPrimary: ResourceColor;
/**
* Secondary level icon reversed, used on a colored background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconOnSecondary: ResourceColor;
/**
* Tertiary level icon reversed, used on a colored background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconOnTertiary: ResourceColor;
/**
* Fourth level icon reversed, used on a colored background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconOnFourth: ResourceColor;
/**
* System Primary level background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundPrimary: ResourceColor;
/**
* System Secondary level background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundSecondary: ResourceColor;
/**
* System tertiary level background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundTertiary: ResourceColor;
/**
* System fourth level background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundFourth: ResourceColor;
/**
* System emphasize level background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
backgroundEmphasize: ResourceColor;
/**
* CompForegroundPrimary color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compForegroundPrimary: ResourceColor;
/**
* CompBackgroundPrimary color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundPrimary: ResourceColor;
/**
* CompBackgroundPrimaryTran color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundPrimaryTran: ResourceColor;
/**
* CompBackgroundPrimaryContrary color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundPrimaryContrary: ResourceColor;
/**
* CompBackgroundGray color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundGray: ResourceColor;
/**
* 10% black universal control background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundSecondary: ResourceColor;
/**
* 5% black universal control background.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundTertiary: ResourceColor;
/**
* 100% bright brand background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundEmphasize: ResourceColor;
/**
* Black neutral high gloss color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundNeutral: ResourceColor;
/**
* 20% High gloss brand background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compEmphasizeSecondary: ResourceColor;
/**
* 10% High gloss brand background color.
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compEmphasizeTertiary: ResourceColor;
/**
* Universal Division Line Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compDivider: ResourceColor;
/**
* CompCommonContrary Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compCommonContrary: ResourceColor;
/**
* CompBackgroundFocus Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compBackgroundFocus: ResourceColor;
/**
* CompFocusedPrimary Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compFocusedPrimary: ResourceColor;
/**
* CompFocusedSecondary Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compFocusedSecondary: ResourceColor;
/**
* CompFocusedTertiary Color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
compFocusedTertiary: ResourceColor;
/**
* Hover interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactiveHover: ResourceColor;
/**
* Pressed interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactivePressed: ResourceColor;
/**
* Focus interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactiveFocus: ResourceColor;
/**
* Active interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactiveActive: ResourceColor;
/**
* Select interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactiveSelect: ResourceColor;
/**
* Click interactive color
*
* @type { ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
interactiveClick: ResourceColor;
}
/**
* Defines the struct of CustomTheme.
*
* @interface CustomTheme
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export declare interface CustomTheme {
/**
* Define tokens associated with color resources..
*
* @type { ?CustomColors }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
colors?: CustomColors;
}
/**
* Defines the struct of CustomColors.
*
* @typedef { Partial<Colors> } CustomColors
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export declare type CustomColors = Partial<Colors>;
/**
* Class ThemeControl provides the Theme management for whole Ability and pages.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
export declare class ThemeControl {
/**
* Sets the default Theme:
* - for whole Ability when invoked from the Ability level code.
* - for the ArkUI page and for later opened pages when invoked at the ArkUI page level.
*
* @param { CustomTheme } theme
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
static setDefaultTheme(theme: CustomTheme): void;
}