summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-12 00:07:42 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-12 00:07:42 +0000
commit8b1a931b39efcd75b1a8e212e23b4c52e33308af (patch)
treeac1ef4bf7c2cdee1d1cfaf55d10411d4dbdc79f1 /app
parent6f020e99420b83918f752e7df9302e659630e0f9 (diff)
downloadchromium_src-8b1a931b39efcd75b1a8e212e23b4c52e33308af.zip
chromium_src-8b1a931b39efcd75b1a8e212e23b4c52e33308af.tar.gz
chromium_src-8b1a931b39efcd75b1a8e212e23b4c52e33308af.tar.bz2
Theme download status message, so that it's readable in themes of any color.
BUG= 21176 TEST= Download something large in a dark or light theme. Note that status update (notification of how much data is left to download) is legible. Review URL: http://codereview.chromium.org/488002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/color_utils.cc14
-rw-r--r--app/gfx/color_utils.h3
2 files changed, 10 insertions, 7 deletions
diff --git a/app/gfx/color_utils.cc b/app/gfx/color_utils.cc
index 05b8bfa..ebc886a 100644
--- a/app/gfx/color_utils.cc
+++ b/app/gfx/color_utils.cc
@@ -48,7 +48,7 @@ int GetLumaForColor(SkColor* color) {
return std::max(std::min(luma, 255), 0);
}
-// Next three functions' formulas from:
+// Next two functions' formulas from:
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
@@ -65,12 +65,6 @@ SkColor LumaInvertColor(const SkColor& color) {
return HSLToSkColor(hsl, 255);
}
-double RelativeLuminance(SkColor color) {
- return (0.2126 * ConvertSRGB(SkColorGetR(color))) +
- (0.7152 * ConvertSRGB(SkColorGetG(color))) +
- (0.0722 * ConvertSRGB(SkColorGetB(color))) + 0.05;
-}
-
double ContrastRatio(double foreground_luminance, double background_luminance) {
// NOTE: Only pass in numbers obtained from RelativeLuminance(), since those
// are guaranteed to be > 0 and thus not cause a divide-by-zero error here.
@@ -83,6 +77,12 @@ double ContrastRatio(double foreground_luminance, double background_luminance) {
// ----------------------------------------------------------------------------
+double RelativeLuminance(SkColor color) {
+ return (0.2126 * ConvertSRGB(SkColorGetR(color))) +
+ (0.7152 * ConvertSRGB(SkColorGetG(color))) +
+ (0.0722 * ConvertSRGB(SkColorGetB(color))) + 0.05;
+}
+
void SkColorToHSL(SkColor c, HSL* hsl) {
double r = static_cast<double>(SkColorGetR(c)) / 255.0;
double g = static_cast<double>(SkColorGetG(c)) / 255.0;
diff --git a/app/gfx/color_utils.h b/app/gfx/color_utils.h
index bbf2595..3e2f8bf 100644
--- a/app/gfx/color_utils.h
+++ b/app/gfx/color_utils.h
@@ -18,6 +18,9 @@ struct HSL {
double l;
};
+// Calculated according to http://www.w3.org/TR/WCAG20/#relativeluminancedef
+double RelativeLuminance(SkColor color);
+
// Note: these transformations assume sRGB as the source color space
void SkColorToHSL(SkColor c, HSL* hsl);
SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha);