summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 21:59:38 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 21:59:38 +0000
commit9ddb1e9d3c36bcd5af1a96cd0452fcb3e3c36dc5 (patch)
tree16c72480277f3c7ecabcc20fe0a6081db3e887b2 /chrome/browser
parent9d7eed94008640d64ce3e6108829509eaa52c4b1 (diff)
downloadchromium_src-9ddb1e9d3c36bcd5af1a96cd0452fcb3e3c36dc5.zip
chromium_src-9ddb1e9d3c36bcd5af1a96cd0452fcb3e3c36dc5.tar.gz
chromium_src-9ddb1e9d3c36bcd5af1a96cd0452fcb3e3c36dc5.tar.bz2
Simplify life for people trying to pick a "readable" foreground color by not requiring them to provide two choices. This also speeds the call up a tiny bit by not calculating the background luminance twice.
BUG=none TEST=none Review URL: http://codereview.chromium.org/220029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27138 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc6
-rw-r--r--chrome/browser/views/location_bar_view.cc24
2 files changed, 8 insertions, 22 deletions
diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
index 7efee67..ea1908e 100644
--- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -67,13 +67,11 @@ SkColor GetColor(ResultViewState state, ColorKind kind) {
color_utils::AlphaBlend(colors[SELECTED][BACKGROUND],
colors[NORMAL][BACKGROUND], 64);
colors[HOVERED][TEXT] = colors[NORMAL][TEXT];
- const SkColor kDarkURL = SkColorSetRGB(0, 128, 0);
- const SkColor kLightURL = SkColorSetRGB(128, 255, 128);
for (int i = 0; i < NUM_STATES; ++i) {
colors[i][DIMMED_TEXT] =
color_utils::AlphaBlend(colors[i][TEXT], colors[i][BACKGROUND], 128);
- colors[i][URL] = color_utils::PickMoreReadableColor(kDarkURL, kLightURL,
- colors[i][BACKGROUND]);
+ colors[i][URL] = color_utils::GetReadableColor(SkColorSetRGB(0, 128, 0),
+ colors[i][BACKGROUND]);
}
initialized = true;
}
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 4becb2f..0e3e104 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -238,27 +238,15 @@ SkColor LocationBarView::GetColor(bool is_secure, ColorKind kind) {
colors[SECURE][DEEMPHASIZED_TEXT] =
color_utils::AlphaBlend(colors[SECURE][TEXT],
colors[SECURE][BACKGROUND], 128);
- const SkColor kDarkNotSecureText = SkColorSetRGB(200, 0, 0);
- const SkColor kLightNotSecureText = SkColorSetRGB(255, 55, 55);
- colors[NOT_SECURE][SECURITY_TEXT] =
- color_utils::PickMoreReadableColor(kDarkNotSecureText,
- kLightNotSecureText,
- colors[NOT_SECURE][BACKGROUND]);
+ colors[NOT_SECURE][SECURITY_TEXT] = color_utils::GetReadableColor(
+ SkColorSetRGB(200, 0, 0), colors[NOT_SECURE][BACKGROUND]);
colors[SECURE][SECURITY_TEXT] = SkColorSetRGB(0, 150, 20);
colors[NOT_SECURE][SECURITY_INFO_BUBBLE_TEXT] =
colors[NOT_SECURE][SECURITY_TEXT];
- const SkColor kDarkSecureInfoBubbleText = SkColorSetRGB(0, 153, 51);
- const SkColor kLightSecureInfoBubbleText = SkColorSetRGB(102, 255, 152);
- colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] =
- color_utils::PickMoreReadableColor(kDarkSecureInfoBubbleText,
- kLightSecureInfoBubbleText,
- colors[NOT_SECURE][BACKGROUND]);
- const SkColor kDarkSchemeStrikeout = SkColorSetRGB(210, 0, 0);
- const SkColor kLightSchemeStrikeout = SkColorSetRGB(255, 45, 45);
- colors[NOT_SECURE][SCHEME_STRIKEOUT] =
- color_utils::PickMoreReadableColor(kDarkSchemeStrikeout,
- kLightSchemeStrikeout,
- colors[NOT_SECURE][BACKGROUND]);
+ colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] = color_utils::GetReadableColor(
+ SkColorSetRGB(0, 153, 51), colors[NOT_SECURE][BACKGROUND]);
+ colors[NOT_SECURE][SCHEME_STRIKEOUT] = color_utils::GetReadableColor(
+ SkColorSetRGB(210, 0, 0), colors[NOT_SECURE][BACKGROUND]);
colors[SECURE][SCHEME_STRIKEOUT] = 0; // Unused
initialized = true;
}