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

Side by Side Diff: ui/views/controls/button/md_text_button.cc

Issue 2411343003: views: lighten stroke for STATE_DISABLED buttons (Closed)
Patch Set: rebase Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/views/controls/button/md_text_button.h" 5 #include "ui/views/controls/button/md_text_button.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "ui/base/material_design/material_design_controller.h" 8 #include "ui/base/material_design/material_design_controller.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/color_palette.h" 10 #include "ui/gfx/color_palette.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 bg_color = color_utils::GetResultingPaintColor(shade, bg_color); 270 bg_color = color_utils::GetResultingPaintColor(shade, bg_color);
271 } 271 }
272 272
273 // Specified text color: 5a5a5a @ 1.0 alpha 273 // Specified text color: 5a5a5a @ 1.0 alpha
274 // Specified stroke color: 000000 @ 0.2 alpha 274 // Specified stroke color: 000000 @ 0.2 alpha
275 // 000000 @ 0.2 is very close to 5a5a5a @ 0.308 (== 0x4e); both are cccccc @ 275 // 000000 @ 0.2 is very close to 5a5a5a @ 0.308 (== 0x4e); both are cccccc @
276 // 1.0, and this way if NativeTheme changes the button color, the button 276 // 1.0, and this way if NativeTheme changes the button color, the button
277 // stroke will also change colors to match. 277 // stroke will also change colors to match.
278 SkColor stroke_color = 278 SkColor stroke_color =
279 is_prominent_ ? SK_ColorTRANSPARENT : SkColorSetA(text_color, 0x4e); 279 is_prominent_ ? SK_ColorTRANSPARENT : SkColorSetA(text_color, 0x4e);
280
281 // Disabled, non-prominent buttons need their stroke lightened. Prominent
282 // buttons need it left at SK_ColorTRANSPARENT from above.
283 if (state() == STATE_DISABLED && !is_prominent_) {
284 stroke_color = color_utils::BlendTowardOppositeLuma(
285 stroke_color, gfx::kDisabledControlAlpha);
286 }
287
280 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); 288 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color)));
281 set_background(Background::CreateBackgroundPainter( 289 set_background(Background::CreateBackgroundPainter(
282 true, Painter::CreateRoundRectWith1PxBorderPainter( 290 true, Painter::CreateRoundRectWith1PxBorderPainter(
283 bg_color, stroke_color, kInkDropSmallCornerRadius))); 291 bg_color, stroke_color, kInkDropSmallCornerRadius)));
284 } 292 }
285 293
286 } // namespace views 294 } // namespace views
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