Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/gfx/color_utils.h

Issue 2319313003: views: refactor away PlatformStyle::BackgroundColorForMdButton (Closed)
Patch Set: nits and rename Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc ('k') | ui/gfx/color_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef UI_GFX_COLOR_UTILS_H_ 5 #ifndef UI_GFX_COLOR_UTILS_H_
6 #define UI_GFX_COLOR_UTILS_H_ 6 #define UI_GFX_COLOR_UTILS_H_
7 7
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 #include "ui/gfx/gfx_export.h" 9 #include "ui/gfx/gfx_export.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // bitmap are all the same brightness. 87 // bitmap are all the same brightness.
88 GFX_EXPORT double CalculateBoringScore(const SkBitmap& bitmap); 88 GFX_EXPORT double CalculateBoringScore(const SkBitmap& bitmap);
89 89
90 // Returns a blend of the supplied colors, ranging from |background| (for 90 // Returns a blend of the supplied colors, ranging from |background| (for
91 // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of 91 // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of
92 // the supplied colors are also taken into account, so the returned color may 92 // the supplied colors are also taken into account, so the returned color may
93 // be partially transparent. 93 // be partially transparent.
94 GFX_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background, 94 GFX_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background,
95 SkAlpha alpha); 95 SkAlpha alpha);
96 96
97 // Returns the color that results from painting |foreground| on top of
98 // |background|.
99 GFX_EXPORT SkColor GetResultingPaintColor(SkColor foreground,
100 SkColor background);
101
97 // Returns true if the luma of |color| is closer to black than white. 102 // Returns true if the luma of |color| is closer to black than white.
98 GFX_EXPORT bool IsDark(SkColor color); 103 GFX_EXPORT bool IsDark(SkColor color);
99 104
100 // Makes a dark color lighter or a light color darker by blending |color| with 105 // Makes a dark color lighter or a light color darker by blending |color| with
101 // white or black depending on its current luma. |alpha| controls the amount of 106 // white or black depending on its current luma. |alpha| controls the amount of
102 // white or black that will be alpha-blended into |color|. 107 // white or black that will be alpha-blended into |color|.
103 GFX_EXPORT SkColor BlendTowardOppositeLuma(SkColor color, SkAlpha alpha); 108 GFX_EXPORT SkColor BlendTowardOppositeLuma(SkColor color, SkAlpha alpha);
104 109
105 // Given a foreground and background color, try to return a foreground color 110 // Given a foreground and background color, try to return a foreground color
106 // that is "readable" over the background color by luma-inverting the foreground 111 // that is "readable" over the background color by luma-inverting the foreground
(...skipping 22 matching lines...) Expand all
129 // light-on-dark color scheme. 134 // light-on-dark color scheme.
130 GFX_EXPORT bool IsInvertedColorScheme(); 135 GFX_EXPORT bool IsInvertedColorScheme();
131 136
132 // Derives a color for icons on a UI surface based on the text color on the same 137 // Derives a color for icons on a UI surface based on the text color on the same
133 // surface. 138 // surface.
134 GFX_EXPORT SkColor DeriveDefaultIconColor(SkColor text_color); 139 GFX_EXPORT SkColor DeriveDefaultIconColor(SkColor text_color);
135 140
136 } // namespace color_utils 141 } // namespace color_utils
137 142
138 #endif // UI_GFX_COLOR_UTILS_H_ 143 #endif // UI_GFX_COLOR_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc ('k') | ui/gfx/color_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698