OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/native_theme/native_theme_dark_aura.h" | 5 #include "ui/native_theme/native_theme_dark_aura.h" |
6 | 6 |
7 #include "ui/base/material_design/material_design_controller.h" | 7 #include "ui/base/material_design/material_design_controller.h" |
8 #include "ui/gfx/color_palette.h" | 8 #include "ui/gfx/color_palette.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 NativeThemeDarkAura* NativeThemeDarkAura::instance() { | 12 NativeThemeDarkAura* NativeThemeDarkAura::instance() { |
13 CR_DEFINE_STATIC_LOCAL(NativeThemeDarkAura, s_native_theme, ()); | 13 CR_DEFINE_STATIC_LOCAL(NativeThemeDarkAura, s_native_theme, ()); |
14 return &s_native_theme; | 14 return &s_native_theme; |
15 } | 15 } |
16 | 16 |
17 SkColor NativeThemeDarkAura::GetSystemColor(ColorId color_id) const { | 17 SkColor NativeThemeDarkAura::GetSystemColor(ColorId color_id) const { |
18 if (!ui::MaterialDesignController::IsModeMaterial()) | 18 if (!ui::MaterialDesignController::IsModeMaterial()) |
19 return NativeThemeAura::GetSystemColor(color_id); | 19 return NativeThemeAura::GetSystemColor(color_id); |
20 | 20 |
21 static const SkColor kPrimaryTextColor = SK_ColorWHITE; | 21 static const SkColor kPrimaryTextColor = SK_ColorWHITE; |
22 static const SkColor kDisabledTextColor = SkColorSetA(SK_ColorWHITE, 0x61); | |
23 static const SkColor kDefaultDarkBackground = SkColorSetRGB(0x3C, 0x3C, 0x3E); | 22 static const SkColor kDefaultDarkBackground = SkColorSetRGB(0x3C, 0x3C, 0x3E); |
24 | 23 |
25 static const SkColor kButtonEnabledColor = SK_ColorWHITE; | 24 static const SkColor kButtonEnabledColor = SK_ColorWHITE; |
26 | 25 |
27 static const SkColor kTextfieldDefaultColor = SK_ColorWHITE; | 26 static const SkColor kTextfieldDefaultColor = SK_ColorWHITE; |
28 static const SkColor kTextfieldDefaultBackground = | 27 static const SkColor kTextfieldDefaultBackground = |
29 SkColorSetRGB(0x62, 0x62, 0x62); | 28 SkColorSetRGB(0x62, 0x62, 0x62); |
30 static const SkColor kTextfieldSelectionBackgroundFocused = | 29 static const SkColor kTextfieldSelectionBackgroundFocused = |
31 SkColorSetA(gfx::kGoogleBlue700, 0xCC); | 30 SkColorSetA(gfx::kGoogleBlue700, 0xCC); |
32 | 31 |
33 static const SkColor kResultsTableNormalBackground = | 32 static const SkColor kResultsTableNormalBackground = |
34 SkColorSetRGB(0x28, 0x28, 0x28); | 33 SkColorSetRGB(0x28, 0x28, 0x28); |
35 static const SkColor kResultsTableText = SK_ColorWHITE; | 34 static const SkColor kResultsTableText = SK_ColorWHITE; |
36 static const SkColor kResultsTableDimmedText = | 35 static const SkColor kResultsTableDimmedText = |
37 SkColorSetA(kResultsTableText, 0x80); | 36 SkColorSetA(kResultsTableText, 0x80); |
38 | 37 |
39 switch (color_id) { | 38 switch (color_id) { |
40 // Button | 39 // Button |
41 case kColorId_ButtonEnabledColor: | 40 case kColorId_ButtonEnabledColor: |
42 return kButtonEnabledColor; | 41 return kButtonEnabledColor; |
43 case kColorId_CallToActionColor: | 42 case kColorId_CallToActionColor: |
44 return gfx::kGoogleBlue300; | 43 return gfx::kGoogleBlue300; |
45 | 44 |
46 // Label | 45 // Label |
47 case kColorId_LabelEnabledColor: | 46 case kColorId_LabelEnabledColor: |
48 return kPrimaryTextColor; | 47 return kPrimaryTextColor; |
49 case kColorId_LabelDisabledColor: | |
50 return kDisabledTextColor; | |
51 case kColorId_LabelBackgroundColor: | 48 case kColorId_LabelBackgroundColor: |
52 return kDefaultDarkBackground; | 49 return kDefaultDarkBackground; |
53 | 50 |
54 // Link | 51 // Link |
55 case kColorId_LinkEnabled: | 52 case kColorId_LinkEnabled: |
56 case kColorId_LinkPressed: | 53 case kColorId_LinkPressed: |
57 return gfx::kGoogleBlue300; | 54 return gfx::kGoogleBlue300; |
58 | 55 |
59 // Textfield | 56 // Textfield |
60 case kColorId_TextfieldDefaultColor: | 57 case kColorId_TextfieldDefaultColor: |
(...skipping 22 matching lines...) Expand all Loading... |
83 | 80 |
84 // Alert icons | 81 // Alert icons |
85 case kColorId_AlertSeverityLow: | 82 case kColorId_AlertSeverityLow: |
86 return gfx::kGoogleGreen300; | 83 return gfx::kGoogleGreen300; |
87 case kColorId_AlertSeverityMedium: | 84 case kColorId_AlertSeverityMedium: |
88 return gfx::kGoogleYellow300; | 85 return gfx::kGoogleYellow300; |
89 case kColorId_AlertSeverityHigh: | 86 case kColorId_AlertSeverityHigh: |
90 return gfx::kGoogleRed300; | 87 return gfx::kGoogleRed300; |
91 | 88 |
92 // Intentional pass-throughs to NativeThemeAura. | 89 // Intentional pass-throughs to NativeThemeAura. |
| 90 case kColorId_LabelDisabledColor: |
93 case kColorId_TextOnCallToActionColor: | 91 case kColorId_TextOnCallToActionColor: |
94 case kColorId_ButtonPressedShade: | 92 case kColorId_ButtonPressedShade: |
95 case kColorId_ResultsTableHoveredBackground: | 93 case kColorId_ResultsTableHoveredBackground: |
96 case kColorId_ResultsTableSelectedBackground: | 94 case kColorId_ResultsTableSelectedBackground: |
97 case kColorId_ResultsTableNormalUrl: | 95 case kColorId_ResultsTableNormalUrl: |
98 case kColorId_ResultsTableHoveredUrl: | 96 case kColorId_ResultsTableHoveredUrl: |
99 case kColorId_ResultsTableSelectedUrl: | 97 case kColorId_ResultsTableSelectedUrl: |
100 return NativeThemeAura::GetSystemColor(color_id); | 98 return NativeThemeAura::GetSystemColor(color_id); |
101 | 99 |
102 // Any other color is not defined and shouldn't be used in a dark theme. | 100 // Any other color is not defined and shouldn't be used in a dark theme. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 158 |
161 NOTREACHED(); | 159 NOTREACHED(); |
162 return gfx::kPlaceholderColor; | 160 return gfx::kPlaceholderColor; |
163 } | 161 } |
164 | 162 |
165 NativeThemeDarkAura::NativeThemeDarkAura() {} | 163 NativeThemeDarkAura::NativeThemeDarkAura() {} |
166 | 164 |
167 NativeThemeDarkAura::~NativeThemeDarkAura() {} | 165 NativeThemeDarkAura::~NativeThemeDarkAura() {} |
168 | 166 |
169 } // namespace ui | 167 } // namespace ui |
OLD | NEW |