Skip to content
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

PR: Add dark css for the Help and IPython Console plugins #8086

Merged
merged 9 commits into from
Oct 28, 2018

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Oct 16, 2018

Pull Request Checklist

  • Read and followed this repo's Contributing Guidelines
  • Based this PR on the latest version of the correct branch (master or 3.x)
  • Followed PEP 8 code style
  • Described the changes and the motivation for them below
  • Noted what issue(s) this pull request resolves, creating one if needed
  • Included a screenshot, if this PR makes any visible changes to the UI

Developer Certificate of Origin Affirmation

By submitting this Pull Request or typing my name below, I affirm the
Developer Certificate of Origin
with respect to both the content of the contribution itself and this post,
and understand I am releasing it under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: dalthviz

Description of Changes

Add CSS for the Help plugin in a dark theme.

imagen

Issue(s) Resolved

Part of #8068

Fixes #8087

@dalthviz dalthviz added this to the v4.0beta2 milestone Oct 16, 2018
@dalthviz dalthviz self-assigned this Oct 16, 2018
@dalthviz dalthviz requested a review from ccordoba12 October 16, 2018 22:34
@pep8speaks
Copy link

pep8speaks commented Oct 16, 2018

Hello @dalthviz! Thanks for updating the PR.

Line 169:1: E402 module level import not at top of file

Comment last updated on October 28, 2018 at 12:40 Hours UTC

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Oct 16, 2018

Issue(s) Resolved
#8068

That's the Epic tracking everything that needs to be done to get the dark theme fully ready to go, so we don't want to close that just yet. I've created an issue specifically for the help pane, and edited your post above to resolve that instead.

EDIT; Sorry, I didn't see you didn't say "Fixes" there...I already created the issue so I added it there, but my mistake.

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dalthviz !

Its not clear what's in scope for this PR, so I'll summarize my comments here and then either implement them here, or open a new issue, add them to #8087 , etc.

  • The "Usage" screen shown whenever Spyder is opened still has the light theme applied
  • The syntax highlighting has a light background and mostly a light-background syntax scheme, but function calls and assignments, etc. are picked up by the text -> white rules and are thus invisible.
  • I suggest a light-medium grey for the code, admonition, signature, etc. boxes if you want to keep using a light theme, since the current very light gray is glaringly bright given the rest of the dark theme. Alternatively, you could use a dark syntax theme and straight black or medium-dark grey for the boxes.
  • Links are rather dark and hard to read; like the Editor, I suggest a lighter shade of blue/cyan

@ccordoba12
Copy link
Member

@dalthviz, please apply the changes in this PR to the IPython console, i.e. to the info_widget of each client, which uses the same CSS as the Help's rich widget.

@dalthviz
Copy link
Member Author

@ccordoba12 @CAM-Gerlach a new preview:

theme

@dalthviz dalthviz changed the title PR: [WIP] Initial css for the Help plugin in a dark theme PR: Initial css for the Help plugin in a dark theme Oct 27, 2018
@dalthviz
Copy link
Member Author

A preview of the highlighting for code:

imagen

Copy link
Member

@CAM-Gerlach CAM-Gerlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking much better! A few additional comments:

  • Can you make the white/light interstitial color (when you trigger introspection and the docstring retrieval and rendering is in progress) the normal dark-theme BG color as well? Its very jarring for it to suddenly flash to white, then back to dark.
  • Could you make links, titles etc. (stuff colored blue) the same lighter blue color as the header bar? They're still a little hard to read.
  • I definitely prefer the look of the code blocks in this version, but now the contrast between the code and the background is getting a little low. If it isn't too much work, would you consider instead making the code the standard Spyder dark theme and the code block background a medium-dark gray (darker than the current, but lighter than the background grey)?

Thanks!

@CAM-Gerlach
Copy link
Member

@ccordoba12 The test failure is the same pylint thing as the other PRs. Its a very quick fix, but I can either simply get the Pylint version and hardcode the expected number of messages accordingly, or (preferred) set a fuzzy range for the number of messages, say 85-99 to be more robust against this happening again, given the seeming likelihood any small variations are unlikely to be due to a problem on Spyder's end.

@ccordoba12
Copy link
Member

Ok, thanks for the suggestion @CAM-Gerlach! I'm preparing a PR right now to fix that.

@ccordoba12
Copy link
Member

@dalthviz, please rebase in top of master to get the latest fixes to our tests.

@ccordoba12 ccordoba12 changed the title PR: Initial css for the Help plugin in a dark theme PR: Add dark css for the Help and IPython Console plugins Oct 27, 2018
@dalthviz
Copy link
Member Author

A new preview:

Help plugin

Usage

imagen

Docstring

imagen
imagen

Spyder Tutorial

imagen
imagen

IPython Console plugin:

Loading message:

imagen

Kernel error message:

imagen

@CAM-Gerlach
Copy link
Member

@dalthviz That looks really sharp and clean! Fantastic!

Only thing is I prefer the colors of the title bar and body of the "Usage" and "An error occurred starting the kernel" boxes to be swapped, as you had in your previous GIF—it looks kind of bottom-heavy and unexpected as is, since generally in UIs one sees the stronger color as part of the title + surrounding frame, while the "body" (e.g. TEST, usage instructions) is more neutral.

@ccordoba12
Copy link
Member

That looks really sharp and clean! Fantastic!

I instructed @dalthviz to follow this

https://bootswatch.com/darkly/

so that's why it looks so good now!

Only thing is I prefer the colors of the title bar and body of the "Usage" and "An error occurred starting the kernel" boxes to be swapped

That's debatable, but I prefer to follow the Darkly theme as it was designed, so I'm going to merge this one as it is for now. Of course, things can changed latter if others agree.

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @dalthviz! I left some minor comments, then this will be ready.

@@ -576,12 +576,19 @@ def setup(self):
logger.info("Applying theme configuration...")
ui_theme = CONF.get('color_schemes', 'ui_theme')
color_scheme = CONF.get('color_schemes', 'selected')
from spyder.plugins.help.utils.sphinxify import CSS_PATH, DARK_CSS_PATH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this import to the top of this file

spyder/plugins/ipythonconsole/plugin.py Show resolved Hide resolved
@@ -76,6 +77,10 @@
dependencies.add("matplotlib", _("Display 2D graphics in the IPython Console"),
required_version=MATPLOTLIB_REQVER, optional=True)

# CSS style
PLUGINS_PATH = get_module_source_path('spyder', 'plugins')
CSS_PATH = osp.join(PLUGINS_PATH, 'help', 'utils', 'static', 'css')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for these two lines because (at the end) CSS_PATH is going to be passed from the main window to this plugin, so please remove them.

@@ -534,7 +539,7 @@ class IPythonConsole(SpyderPluginWidget):
"make it writable.")

def __init__(self, parent, testing=False, test_dir=None,
test_no_stderr=False):
test_no_stderr=False, css_path=CSS_PATH):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to css_path=None

@@ -110,7 +110,8 @@ def __init__(self, plugin, id_,
options_button=None,
show_elapsed_time=False,
reset_warning=True,
ask_before_restart=True):
ask_before_restart=True,
css_path=CSS_PATH):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to css_path=None.

@@ -135,6 +136,7 @@ def __init__(self, plugin, id_,
self.allow_rename = True
self.stderr_dir = None
self.is_error_shown = False
self.css_path = css_path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to

if css_path is None:
    self.css_path = CSS_PATH
else:
    self.css_path = css_path

This way tests for the IPython console alone will pass without problems.

@CAM-Gerlach
Copy link
Member

I instructed @dalthviz to follow this

Great call; it looks amazing!

I prefer to follow the Darkly theme as it was designed,

We can always come back to it later and get e.g. @jnsebgosselin to weigh in. However, I'm not sure where in the Darkly theme it is intended to have warning dialogs look like that; the closest I see is

image

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @dalthviz!! Really great job here!

@ccordoba12 ccordoba12 merged commit a3af9c7 into spyder-ide:master Oct 28, 2018
@Ticonderoga
Copy link

Ticonderoga commented Dec 9, 2018

The css is realy great !! But it doesn't work for table ! As an example try to get the documentation about scipy.optimize. The background is white and with a white text it becomes unreadable.

Thanks for your work

@CAM-Gerlach
Copy link
Member

CAM-Gerlach commented Dec 9, 2018

Thanks @Ticonderoga ! Here's an example screenshot of what you're describing; also, it shows the scrollbar is still unthemed. I'll add it to #8068 .

image

@ccordoba12
Copy link
Member

@dalthviz, please solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dark theme style to Help pane
5 participants