1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_THEME_APP_THEME_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_THEME_APP_THEME_H 18 19 #include <unordered_map> 20 21 #include "core/components/common/properties/color.h" 22 #include "core/components/theme/theme.h" 23 #include "core/components/theme/theme_constants.h" 24 25 namespace OHOS::Ace { 26 27 /** 28 * AppTheme defines color and styles of whole app. AppTheme should be built 29 * using AppTheme::Builder. 30 */ 31 class AppTheme : public virtual Theme { 32 DECLARE_ACE_TYPE(AppTheme, Theme); 33 34 public: 35 class Builder { 36 public: 37 Builder() = default; 38 ~Builder() = default; 39 40 RefPtr<AppTheme> Build(const RefPtr<ThemeConstants>& themeConstants) const; 41 }; 42 43 ~AppTheme() override = default; 44 GetBackgroundColor()45 const Color& GetBackgroundColor() const 46 { 47 return backgroundColor_; 48 } 49 SetBackgroundColor(const Color & color)50 void SetBackgroundColor(const Color& color) 51 { 52 backgroundColor_ = color; 53 } 54 55 protected: 56 AppTheme() = default; 57 58 private: 59 Color backgroundColor_; 60 }; 61 62 } // namespace OHOS::Ace 63 64 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_THEME_APP_THEME_H 65