| OLD | NEW |
| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 bg_color = color_utils::BlendTowardOppositeLuma( | 263 bg_color = color_utils::BlendTowardOppositeLuma( |
| 264 bg_color, gfx::kDisabledControlAlpha); | 264 bg_color, gfx::kDisabledControlAlpha); |
| 265 } | 265 } |
| 266 | 266 |
| 267 if (state() == STATE_PRESSED) { | 267 if (state() == STATE_PRESSED) { |
| 268 SkColor shade = | 268 SkColor shade = |
| 269 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonPressedShade); | 269 theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonPressedShade); |
| 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 |
| 274 // Specified stroke color: 000000 @ 0.2 alpha |
| 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 |
| 277 // stroke will also change colors to match. |
| 273 SkColor stroke_color = | 278 SkColor stroke_color = |
| 274 is_prominent_ ? SK_ColorTRANSPARENT : SkColorSetA(text_color, 0x33); | 279 is_prominent_ ? SK_ColorTRANSPARENT : SkColorSetA(text_color, 0x4e); |
| 275 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); | 280 DCHECK_EQ(SK_AlphaOPAQUE, static_cast<int>(SkColorGetA(bg_color))); |
| 276 set_background(Background::CreateBackgroundPainter( | 281 set_background(Background::CreateBackgroundPainter( |
| 277 true, Painter::CreateRoundRectWith1PxBorderPainter( | 282 true, Painter::CreateRoundRectWith1PxBorderPainter( |
| 278 bg_color, stroke_color, kInkDropSmallCornerRadius))); | 283 bg_color, stroke_color, kInkDropSmallCornerRadius))); |
| 279 } | 284 } |
| 280 | 285 |
| 281 } // namespace views | 286 } // namespace views |
| OLD | NEW |