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

Unified Diff: app/gfx/color_utils.h

Issue 220029: Simplify life for people trying to pick a "readable" foreground color by not ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | app/gfx/color_utils.cc » ('j') | app/gfx/color_utils.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gfx/color_utils.h
===================================================================
--- app/gfx/color_utils.h (revision 27031)
+++ app/gfx/color_utils.h (working copy)
@@ -57,11 +57,14 @@
// |alpha| == 0) to |foreground| (for |alpha| == 255).
SkColor AlphaBlend(SkColor foreground, SkColor background, SkAlpha alpha);
-// Given two possible foreground colors, return the one that is more readable
-// over |background|.
-SkColor PickMoreReadableColor(SkColor foreground1,
- SkColor foreground2,
- SkColor background);
+// Given a foreground and background color, try to return a foreground color
+// that is "readable" over the background color by luma-inverting the foreground
+// color and then picking whichever foreground color has higher contrast against
+// the background color.
+//
+// NOTE: This won't do anything but waste time if the supplied foreground color
+// has a luma value close to the midpoint (0.5 in the HSL representation).
+SkColor GetReadableColor(SkColor foreground, SkColor background);
// Gets a Windows system color as a SkColor
SkColor GetSysSkColor(int which);
« no previous file with comments | « no previous file | app/gfx/color_utils.cc » ('j') | app/gfx/color_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698