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

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

Issue 1977693004: [MD] Adjust algorithm for colorizing icons in incognito contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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 #include "ui/gfx/color_utils.h" 5 #include "ui/gfx/color_utils.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 322
323 // OS_WIN implementation lives in sys_color_change_listener.cc 323 // OS_WIN implementation lives in sys_color_change_listener.cc
324 #if !defined(OS_WIN) 324 #if !defined(OS_WIN)
325 bool IsInvertedColorScheme() { 325 bool IsInvertedColorScheme() {
326 return false; 326 return false;
327 } 327 }
328 #endif // !defined(OS_WIN) 328 #endif // !defined(OS_WIN)
329 329
330 SkColor DeriveDefaultIconColor(SkColor text_color) { 330 SkColor DeriveDefaultIconColor(SkColor text_color) {
331 // This function works similarly to BlendTowardOppositeLuminance, but uses a 331 // Lighten a dark color but leave it fully opaque.
332 // different blend value for lightening and darkening.
333 if (IsDark(text_color)) { 332 if (IsDark(text_color)) {
334 // For black text, this comes out to kChromeIconGrey. 333 // For black text, this comes out to kChromeIconGrey.
335 return color_utils::AlphaBlend(SK_ColorWHITE, text_color, 334 return color_utils::AlphaBlend(SK_ColorWHITE, text_color,
336 SkColorGetR(gfx::kChromeIconGrey)); 335 SkColorGetR(gfx::kChromeIconGrey));
337 } 336 }
338 // The dimming is less dramatic when darkening a light color. 337 // For a light color, just set an opacity.
339 return color_utils::AlphaBlend(SK_ColorBLACK, text_color, 0x33); 338 return SkColorSetA(text_color, 0xCC);
sky 2016/05/13 19:29:34 Might test_color have an alpha < 0xCC?
Evan Stade 2016/05/13 21:20:44 yea, I guess text color can be non-opaque (theme-c
340 } 339 }
341 340
342 } // namespace color_utils 341 } // namespace color_utils
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698