OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_base.h" | 5 #include "ui/native_theme/native_theme_base.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 SkColorSetARGB(0x80, 0xed, 0xed, 0xed), | 60 SkColorSetARGB(0x80, 0xed, 0xed, 0xed), |
61 SkColorSetARGB(0x80, 0xde, 0xde, 0xde) }; | 61 SkColorSetARGB(0x80, 0xde, 0xde, 0xde) }; |
62 const SkColor kCheckboxBorderColor = SkColorSetARGB(0x40, 0, 0, 0); | 62 const SkColor kCheckboxBorderColor = SkColorSetARGB(0x40, 0, 0, 0); |
63 const SkColor kCheckboxBorderHoveredColor = SkColorSetARGB(0x4D, 0, 0, 0); | 63 const SkColor kCheckboxBorderHoveredColor = SkColorSetARGB(0x4D, 0, 0, 0); |
64 const SkColor kCheckboxBorderDisabledColor = SkColorSetARGB(0x20, 0, 0, 0); | 64 const SkColor kCheckboxBorderDisabledColor = SkColorSetARGB(0x20, 0, 0, 0); |
65 const SkColor kCheckboxStrokeColor = SkColorSetARGB(0xB3, 0, 0, 0); | 65 const SkColor kCheckboxStrokeColor = SkColorSetARGB(0xB3, 0, 0, 0); |
66 const SkColor kCheckboxStrokeDisabledColor = SkColorSetARGB(0x59, 0, 0, 0); | 66 const SkColor kCheckboxStrokeDisabledColor = SkColorSetARGB(0x59, 0, 0, 0); |
67 const SkColor kRadioDotColor = SkColorSetRGB(0x66, 0x66, 0x66); | 67 const SkColor kRadioDotColor = SkColorSetRGB(0x66, 0x66, 0x66); |
68 const SkColor kRadioDotDisabledColor = SkColorSetARGB(0x80, 0x66, 0x66, 0x66); | 68 const SkColor kRadioDotDisabledColor = SkColorSetARGB(0x80, 0x66, 0x66, 0x66); |
69 | 69 |
70 const SkColor kInputInvalidColor = SkColorSetRGB(0xde, 0x49, 0x32); | |
71 | |
72 // Get lightness adjusted color. | 70 // Get lightness adjusted color. |
73 SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, | 71 SkColor BrightenColor(const color_utils::HSL& hsl, SkAlpha alpha, |
74 double lightness_amount) { | 72 double lightness_amount) { |
75 color_utils::HSL adjusted = hsl; | 73 color_utils::HSL adjusted = hsl; |
76 adjusted.l += lightness_amount; | 74 adjusted.l += lightness_amount; |
77 if (adjusted.l > 1.0) | 75 if (adjusted.l > 1.0) |
78 adjusted.l = 1.0; | 76 adjusted.l = 1.0; |
79 if (adjusted.l < 0.0) | 77 if (adjusted.l < 0.0) |
80 adjusted.l = 0.0; | 78 adjusted.l = 0.0; |
81 | 79 |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); | 1101 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2f, 0.28f, 0.5f); |
1104 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); | 1102 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5f); |
1105 | 1103 |
1106 if (hsv1[2] + hsv2[2] > 1.0) | 1104 if (hsv1[2] + hsv2[2] > 1.0) |
1107 diff = -diff; | 1105 diff = -diff; |
1108 | 1106 |
1109 return SaturateAndBrighten(hsv2, -0.2f, diff); | 1107 return SaturateAndBrighten(hsv2, -0.2f, diff); |
1110 } | 1108 } |
1111 | 1109 |
1112 } // namespace ui | 1110 } // namespace ui |
OLD | NEW |