-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prefer new .jp-icon-mono
class for monochromatic icons
#12673
base: main
Are you sure you want to change the base?
Conversation
- replaces all monochromatic action icon classes with .jp-icon-mono for consistency - replaces Python icon with one more consistent with Python's style guide (from elyra-ai/elyra#2705) - replaces Markdown icon with icon from dcurtis/markdown-mark Co-authored-by: Piyush Jain <pyjain@gmail.com>
Thanks for making a pull request to jupyterlab! |
Thanks for submitting your first pull request! You are awesome! 🤗 |
One quick question - are there any other colored icons that are getting their colors from a generic JupyterLab theme variable? JSON? YML? Anything else? |
@ellisonbg Good question. There were a few icons that I chose not to touch because they were not monochromatic, so these should probably be reviewed on a case-by-case basis on how we should replace the classes associated with them. The scope of this PR is mainly for monochromatic icons and to fix the most glaring icon CSS issues visible from the JL launcher; a separate issue and PR should be made to address the larger issue of an excessive number of CSS classes being misused throughout JL. Icons still using old CSS classesUses
Uses
Uses
Uses
Uses None. Uses
Uses
Uses
Uses
Key observations
Open questionCan we remove some (if not all) of these CSS classes and replace them with ones that are directly related to the icon?
I personally fail to see a reason we should continue exposing so many |
Thanks for tackling this @dlqqq
I'm 💯 to reduce the number of generic classes and to use more semantic names for specific icons. I'm also wondering if we could not simply drop using a generic class for most icons and set |
@fcollonval Hm, I did some initial testing and it looks like the most obvious issue with your suggestion is that in most cases we don't want the icon to inherit its parent color. See what happens when I set the fill and stroke to currentColor: The icons get set to pure black because that's the default color of text in light mode. We want the icon to be a different color while unselected and have the icon be the same color while selected. Rather than attaching another class to each icon, I suggest that we attach a class to the parent and use a separate selector to target icon descendants of the parent instead. We can provide a generic .jp-color-override > .jp-icon-mono[fill] {
fill: currentColor;
}
.jp-color-override > .jp-icon-mono[stroke] {
stroke: currentColor;
}
.jp-color-override > .jp-icon-mono-inverse[fill] {
opacity: 0.0;
}
.jp-color-override > .jp-icon-mono-inverse[stroke] {
opacity: 0.0;
} It's ambiguous as to how mono inverse color should be handled (e.g. the shell prompt of the terminal icon). I suggest making it transparent as above by default. If greater specificity is needed, developers can forego the TL;DR: delegate responsibility of control to the parent, rather than trying to implement the functionality in the icon styles itself. |
Another action item to add to the wider goal of eliminating excessive generic classes: as we have gathered the styles for monochromatic icons under the |
List of CSS hacks being used that can be fixed with the
|
Thanks for all the tests and report
Thanks for trying.
As you demonstrate, if we are to use a single
💯
Did you try setting
I don't get how introducing
You should not commit |
Yeah, after thinking about this more, it does seem unnecessary as all it does is really just save a few lines and requires the developer to know that the class exists before using it. I think to keep our default CSS classes minimal, we should strike off this idea. I can briefly explain the approach I was thinking of. The idea is to add the TL;DR: the fix for these chained selector hacks is simply to add some class to the parent element that allows us to select icon children to apply style overrides.
@fcollonval Are you sure about this? The |
Reviewed all failing UI snapshots, and there are no remaining unintentional regressions. |
please update snapshots |
I'll take a deep look at this as soon as I have time (prob not until next Monday though) |
@dlqqq you are indeed closer to the solution - the script copying the file from ui-components package needs to be updated:
The path is not |
References
Code changes
prefer new
.jp-icon-mono
class for all monochromatic action icons.jp-icon3
classadds new
.jp-icon-mono-inverse
class to handle inverse colors (e.g. the shell prompt within the terminal icon).replaces Python icon with one more consistent with Python's style guide (from Simplify R and Python icon svgs elyra-ai/elyra#2705)
replaces Markdown icon with icon from dcurtis/markdown-mark
User-facing changes
.jp-icon-mono
over.jp-iconX
classes, which have a much more limited scope as most icons are monochromaticBefore:
After:
Backwards-incompatible changes
The terminal and console icons are now set to a monochromatic icon. Following the discussion in the original issue, it seems that the terminal and console icons are more of "action" icons (typically monochromatic) rather than "document" icons (typically colored to be both consistent with a language/filetype's branding and to be easily identifiable). Definitely open to suggestions here, as this is a significant visual change. This is also an opportunity to change the terminal and console icons altogether.
Most action icons had their previous CSS class removed and replaced with
.jp-icon-mono
. This will break theme extensions that rely on icons having the old CSS classes. However, standardizing the CSS class we are using for monochromatic icons will also make it significantly easier for theme developers to maintain consistent icon theming throughout the JupyterLab UI.