Carbon: [Carbon X] Toggle colors are inaccessible for g90 and g100 themes

Created on 5 Feb 2019  ยท  15Comments  ยท  Source: carbon-design-system/carbon

Detailed description

The Carbon X Toggle component is inaccessible when someone uses the g90 or g100 themes provided by @carbon/themes

Here are a few screenshots with the g100 theme:
screen shot 2019-02-05 at 4 18 37 pm
screen shot 2019-02-05 at 4 18 15 pm

Looks like the issue is related to tokens, like this one here:
https://github.com/IBM/carbon-components/blob/master/src/components/toggle/_toggle.scss#L272

// Toggle circle
&:after {
  background-color: $ui-02;
  ...
}

The $ui-02 color token is gray70 for g90 and gray80 for g100 themes (see: https://carbon-elements.netlify.com/themes/examples/preview/), which makes the toggle's circle invisible when toggled off/deselected.

All 15 comments

@IBM/carbon-designers I'm happy to help fix this ๐Ÿ‘ Just let me know what colors you'd like to see here. Thanks!

@shixiedesign do you know colors they should be on dark? Did we mess a token up?

Hi @jendowns @aagonzales looks like it should just be $ui-03 instead!
Values for $ui-03:

White | G10 | G90 | G100
--- | --- | --- | ---
Gray 20 / #dcdcdc | Gray 20 #dcdcdc | G70 / #565656 | G80 / #3D3D3D

@shixiedesign @aagonzales --

Unfortunately for the Carbon X Toggle, the background is $ui-03 and the circle is $ui-02, which is effectively the same color for g90 and g100 themes (re: https://carbon-elements.netlify.com/themes/examples/preview/):

screen shot 2019-02-07 at 11 07 44 am

So I think we're going to need a different ui token ๐Ÿ˜ฌ What do you think?

EDIT: for our temporary override in our library, we made the circle $ibm-colors__gray-40

Hmm I think that might be a bug. Let me investigate ๐Ÿ•ต๏ธ

Yeah I'm not sure about the solution coz there seems to be a few other things wrong too. The circle shouldn't be G90 as it looks like in the screenshot. I'd suggest continuing with the G40 solution for now and we will get back to you!

@jendowns I think we figured it out! There's a couple more changes to make the toggle On state look better on dark theme too. Could you still tackle this update and send in a PR?

In summary:

  1. Add token: $icon-03 value on all 4 themes are White /#ffffff
  2. Change token $support-02 โ€™s values to Green 50 / #24A148 on both light themes, and Green 40 / #3DBB61 on both dark themes.
  3. Re-assign tokens according to spec image below, Proposed solution column:

image

Sure thing @shixiedesign! Are you able to assign this issue to me? I can get a PR together ๐Ÿ‘

EDIT: first step is to add $icon-03 token to @carbon/themes & then I will follow up here to update the Toggle experimental theme.

Thank you for jumping in @jendowns!!

Just FYI, I'm waiting on https://github.com/IBM/carbon-components/pull/1795 before I can proceed with this (I need the new $icon-03 token) ๐Ÿ‘

@jendowns just a heads up, will pull out the updates into a two parts, I think. Hoping to have it done this morning if folks have a chance to leave feedback ๐Ÿ‘

@shixiedesign I was looking into this and I think there may be a problem with $ui-03 (circle) and $ui-05 (background) for the off state for g90 and g100 themes:

screen shot 2019-02-15 at 3 08 28 pm

In your comment above, you mentioned using those 2 colors to fix some of the contrast issues for the Toggle's off state -- https://github.com/IBM/carbon-components/issues/1731#issuecomment-461562980

Should I update the $ui-03 and $ui-05 color hexes for g90 and g100 in Carbon Elements to better match what you expect them to be?

EDIT: btw I'm looking at the themes here: https://carbon-elements.netlify.com/themes/examples/preview/

@jendowns Omg my bad...correction:

Circle: $ui-03 (Gray70 | Gray80)
Background: $ui-04 (Gray50 | Gray60)

Thank you so much for your patience, Jen. I'm gonna go reflect on why I keep making mistakes here...

@shixiedesign no worries at all! The only way I'm able to keep these tokens straight is by constantly looking at the theme preview site: https://carbon-elements.netlify.com/themes/examples/preview/ ๐Ÿ˜† I appreciate your help with this ๐Ÿ™

Closing this issue, as I can see that the latest version has the correct colors for the g100 theme. Thank you! ๐ŸŽ‰

Was this page helpful?
0 / 5 - 0 ratings

Related issues

windgaucho picture windgaucho  ยท  3Comments

AnthumChris picture AnthumChris  ยท  3Comments

PatrickDuncan picture PatrickDuncan  ยท  3Comments

snidersd picture snidersd  ยท  3Comments

JordanWSmith15 picture JordanWSmith15  ยท  3Comments