summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 21:02:28 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 21:02:28 +0000
commit2d4105beedcf58301fdd7c526f92c1b6140dc0a1 (patch)
tree1847fb3a7efd21e2737c60d67be092d92191350a /chrome
parent0036e3f4c3dfe1c5c553e3697e95e2f27dab81ce (diff)
downloadchromium_src-2d4105beedcf58301fdd7c526f92c1b6140dc0a1.zip
chromium_src-2d4105beedcf58301fdd7c526f92c1b6140dc0a1.tar.gz
chromium_src-2d4105beedcf58301fdd7c526f92c1b6140dc0a1.tar.bz2
GTK Themes: Create an inactive tab text color based on the inactive tab.
(We were previously just grabbing a raw GTK color, which didn't work out very well in themes like High Contrast Inverse...) Review URL: http://codereview.chromium.org/174407 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24316 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_theme_provider.h6
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.cc27
2 files changed, 29 insertions, 4 deletions
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h
index 068509b..fb8a645 100644
--- a/chrome/browser/browser_theme_provider.h
+++ b/chrome/browser/browser_theme_provider.h
@@ -207,6 +207,9 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>,
// Sets an individual tint value.
void SetTint(const char* id, const skia::HSL& tint);
+ // Get the specified tint - |id| is one of the TINT_* enum values.
+ skia::HSL GetTint(int id);
+
// Generate any frame colors that weren't specified.
void GenerateFrameColors();
@@ -261,9 +264,6 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>,
// Returns the default color for the given color |id| COLOR_* enum value.
SkColor GetDefaultColor(int id);
- // Get the specified tint - |id| is one of the TINT_* enum values.
- skia::HSL GetTint(int id);
-
// Tint |bitmap| with the tint specified by |hsl_id|
SkBitmap TintBitmap(const SkBitmap& bitmap, int hsl_id);
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index 63be166..aa8d7ae 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -30,6 +30,13 @@ const skia::HSL kExactColor = { -1, -1, -1 };
const skia::HSL kDefaultFrameShift = { -1, -1, 0.4 };
+// Values used as the new luminance and saturation values in the inactive tab
+// text color.
+const double kDarkInactiveLuminance = 0.85;
+const double kLightInactiveLuminance = 0.15;
+const double kHeavyInactiveSaturation = 0.7;
+const double kLightInactiveSaturation = 0.3;
+
// Minimum difference between the toolbar and the button color before we try a
// different color.
const double kMinimumLuminanceDifference = 0.1;
@@ -278,7 +285,6 @@ void GtkThemeProvider::LoadGtkValues() {
// autogenerated from tints.
SetThemeColorFromGtk(kColorToolbar, &toolbar_color);
SetThemeColorFromGtk(kColorTabText, &label_color);
- SetThemeColorFromGtk(kColorBackgroundTabText, &label_color);
SetThemeColorFromGtk(kColorBookmarkText, &label_color);
SetThemeColorFromGtk(kColorControlBackground,
&window_style->bg[GTK_STATE_NORMAL]);
@@ -296,6 +302,25 @@ void GtkThemeProvider::LoadGtkValues() {
&frame_color,
kDefaultTintBackgroundTab);
+ // The inactive frame color never occurs naturally in the theme, as it is a
+ // tinted version of |frame_color|. We generate another color based on the
+ // background tab color, with the lightness and saturation moved in the
+ // opposite direction. (We don't touch the hue, since there should be subtle
+ // hints of the color in the text.)
+ skia::HSL inactive_tab_text_hsl = GetTint(TINT_BACKGROUND_TAB);
+ if (inactive_tab_text_hsl.l < 0.5)
+ inactive_tab_text_hsl.l = kDarkInactiveLuminance;
+ else
+ inactive_tab_text_hsl.l = kLightInactiveLuminance;
+
+ if (inactive_tab_text_hsl.s < 0.5)
+ inactive_tab_text_hsl.s = kHeavyInactiveSaturation;
+ else
+ inactive_tab_text_hsl.s = kLightInactiveSaturation;
+
+ SetColor(kColorBackgroundTabText,
+ skia::HSLToSkColor(255, inactive_tab_text_hsl));
+
// The inactive color/tint is special: We *must* use the exact insensitive
// color for all inactive windows, otherwise we end up neon pink half the
// time.