|
|
Created:
4 years, 3 months ago by Elly Fong-Jones Modified:
4 years, 3 months ago CC:
chromium-reviews, tfarina Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptionviews: support disabled color for CTA buttons
Disabled buttons use their usual background at 0.38a, so this change
adds a new color ID for their faded background and uses it in
MdTextButton::UpdateColors().
BUG=644543
Committed: https://crrev.com/17e42fe9291fd349c074d84cc6ddf994dc9a98bb
Cr-Commit-Position: refs/heads/master@{#417263}
Patch Set 1 #
Total comments: 2
Patch Set 2 : get rid of CallToActionDisabled #
Total comments: 5
Patch Set 3 : Alpha -> BlendTowardOpposite #Patch Set 4 : rebase #Messages
Total messages: 23 (9 generated)
Description was changed from ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 ========== to ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 ==========
ellyjones@chromium.org changed reviewers: + estade@chromium.org
estade: ptal? :)
https://codereview.chromium.org/2315233002/diff/1/ui/native_theme/native_them... File ui/native_theme/native_theme_dark_aura.cc (right): https://codereview.chromium.org/2315233002/diff/1/ui/native_theme/native_them... ui/native_theme/native_theme_dark_aura.cc:46: return SkColorSetA(gfx::kGoogleBlue300, 255.0 * 0.38); I think it makes sense to keep this in MdTextButton unless we're going to use it somewhere else. Since presumably all native themes want the disabled CTA color to be enabled with 0.38a (normally we use hex, so 0x61), it's simpler to avoid adding a new color id and copying the constant in a lot of places, and instead just stick a hard-coded alpha in MdTextButton.
done, ptal? :) https://codereview.chromium.org/2315233002/diff/1/ui/native_theme/native_them... File ui/native_theme/native_theme_dark_aura.cc (right): https://codereview.chromium.org/2315233002/diff/1/ui/native_theme/native_them... ui/native_theme/native_theme_dark_aura.cc:46: return SkColorSetA(gfx::kGoogleBlue300, 255.0 * 0.38); On 2016/09/07 16:00:35, Evan Stade wrote: > I think it makes sense to keep this in MdTextButton unless we're going to use it > somewhere else. Since presumably all native themes want the disabled CTA color > to be enabled with 0.38a (normally we use hex, so 0x61), it's simpler to avoid > adding a new color id and copying the constant in a lot of places, and instead > just stick a hard-coded alpha in MdTextButton. Done.
https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... File ui/views/controls/button/md_text_button.cc (right): https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... ui/views/controls/button/md_text_button.cc:304: bg_color = SkColorSetA(bg_color, 0x61); I know it's expressed as an alpha value in the spec, but I'm thinking the blend towards opposite luma (like below) is somewhat more correct here than setting an alpha because we probably don't want the color to change based on the background. For example, if we had a disabled CTA button on an infobar with a yellow bg, would we want the button to be somewhat yellow? probably not. https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... ui/views/controls/button/md_text_button.cc:309: bg_color = PlatformStyle::BackgroundColorForMdButton(bg_color, state()); can we make it a todo to get rid of this? Color logic is currently spread across three places: this file, native theme, and platform style :< perhaps: if (pressed()) { SkColor shade_color = theme->GetSystemColor(kColorId_ButtonPressedShade); bg_color = color_utils::Blend(shade_color, bg_color); } (note that AlphaBlend doesn't do quite what we want here so we have to invent a new utility function. I'm pretty sure I've wanted this function in the past but worked around its non-existence so this won't be the only time we'd use it.)
https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... File ui/views/controls/button/md_text_button.cc (right): https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... ui/views/controls/button/md_text_button.cc:309: bg_color = PlatformStyle::BackgroundColorForMdButton(bg_color, state()); On 2016/09/07 17:14:33, Evan Stade wrote: > can we make it a todo to get rid of this? Color logic is currently spread across > three places: this file, native theme, and platform style :< > > perhaps: > > if (pressed()) { > SkColor shade_color = theme->GetSystemColor(kColorId_ButtonPressedShade); > bg_color = color_utils::Blend(shade_color, bg_color); > } > > (note that AlphaBlend doesn't do quite what we want here so we have to invent a > new utility function. I'm pretty sure I've wanted this function in the past but > worked around its non-existence so this won't be the only time we'd use it.) Hm - I like this idea, but what would color_utils::Blend() do? As I understand it there are many different ways to blend two colors together. Also, I think for this specific use, kColorId_ButtonPressedShade would be #FFFFFF with an alpha of #08, and we need a function that would: 1) Extract the alpha, and set the shade's alpha to #FF 2) Set the bg color's alpha to #FF 3) Alpha blend the two with the extracted alpha from step 1 Is that the kind of thing you're thinking of? I don't understand color that well.
estade: ptal? :) https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... File ui/views/controls/button/md_text_button.cc (right): https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... ui/views/controls/button/md_text_button.cc:304: bg_color = SkColorSetA(bg_color, 0x61); On 2016/09/07 17:14:33, Evan Stade wrote: > I know it's expressed as an alpha value in the spec, but I'm thinking the blend > towards opposite luma (like below) is somewhat more correct here than setting an > alpha because we probably don't want the color to change based on the > background. For example, if we had a disabled CTA button on an infobar with a > yellow bg, would we want the button to be somewhat yellow? probably not. Done. https://codereview.chromium.org/2315233002/diff/20001/ui/views/controls/butto... ui/views/controls/button/md_text_button.cc:309: bg_color = PlatformStyle::BackgroundColorForMdButton(bg_color, state()); On 2016/09/07 17:43:50, Elly Jones wrote: > On 2016/09/07 17:14:33, Evan Stade wrote: > > can we make it a todo to get rid of this? Color logic is currently spread > across > > three places: this file, native theme, and platform style :< > > > > perhaps: > > > > if (pressed()) { > > SkColor shade_color = theme->GetSystemColor(kColorId_ButtonPressedShade); > > bg_color = color_utils::Blend(shade_color, bg_color); > > } > > > > (note that AlphaBlend doesn't do quite what we want here so we have to invent > a > > new utility function. I'm pretty sure I've wanted this function in the past > but > > worked around its non-existence so this won't be the only time we'd use it.) > > Hm - I like this idea, but what would color_utils::Blend() do? As I understand > it there are many different ways to blend two colors together. > > Also, I think for this specific use, kColorId_ButtonPressedShade would be > #FFFFFF with an alpha of #08, and we need a function that would: > > 1) Extract the alpha, and set the shade's alpha to #FF > 2) Set the bg color's alpha to #FF > 3) Alpha blend the two with the extracted alpha from step 1 > > Is that the kind of thing you're thinking of? I don't understand color that > well. I ended up adding a TODO for this.
lgtm
ellyjones@chromium.org changed reviewers: + sky@chromium.org
sky: ptal? :)
LGTM
The CQ bit was checked by ellyjones@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-device on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-device/builds...) ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...)
The CQ bit was checked by ellyjones@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sky@chromium.org, estade@chromium.org Link to the patchset: https://codereview.chromium.org/2315233002/#ps60001 (title: "rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 ========== to ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 ==========
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 ========== to ========== views: support disabled color for CTA buttons Disabled buttons use their usual background at 0.38a, so this change adds a new color ID for their faded background and uses it in MdTextButton::UpdateColors(). BUG=644543 Committed: https://crrev.com/17e42fe9291fd349c074d84cc6ddf994dc9a98bb Cr-Commit-Position: refs/heads/master@{#417263} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/17e42fe9291fd349c074d84cc6ddf994dc9a98bb Cr-Commit-Position: refs/heads/master@{#417263} |