-
Notifications
You must be signed in to change notification settings - Fork 0
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
WIP: dark mode #1
base: master
Are you sure you want to change the base?
Conversation
Based loosely on @birgersp's code at <prati0100/git-gui#64 (comment)>. Limitations: * There is no attempt to make this configurable yet. * It has only been tested on Linux (using Englightenment with a dark system theme). * The colour of the border around widgets when they are focused is not consistent. On my system it is sometimes light blue (which I haven't set anywhere, so it must be coming from the underlying theme), and sometimes an almost invisible dark blue. * I'm forcing a particular underlying theme, 'alt', which might not be to everyone's taste. * Some less commonly used dialog boxes still have light elements (but they're at least readable). * The banners for "Unstaged Changes", "Staged for commit", and "Staged Changes" should be made darker and use white text. * The contrast of red and green in diffs is uneven. * Some UI elements may be too small on high-resolution screens. * Dialogs flicker white initially and take visible time to draw. There's probably a way to set the right starting background colour. * Disabled text on a checkbox control is ugly in my opinion (for an example, see "Tools | Add..." when "Show a dialog before running" is unchecked). I don't know what whoever decided it should use that fake-3D effect was thinking. * I don't know what that light grey rectangle in the bottom right is. Signed-off-by: Daira-Emma Hopwood <[email protected]>
@@ -3272,7 +3272,7 @@ ttext $ui_workdir \ | |||
-borderwidth 0 \ | |||
-width 20 -height 10 \ | |||
-wrap none \ | |||
-takefocus 1 -highlightthickness 1\ | |||
-takefocus 1 -highlightthickness 1 -highlightcolor #f0f0f0 -highlightbackground #303030 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly and should be abstracted out. It doesn't work to use $color::{focused,unfocused}
variables because they might not have been initialized yet.
@@ -3606,13 +3605,13 @@ $ui_diff tag conf d_+s \ | |||
-foreground {#00a000} \ | |||
-background {#e2effa} | |||
$ui_diff tag conf d_-s \ | |||
-foreground red \ | |||
-foreground darkred \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly abstract these colours. Getting the right contrast is really important for diffs; for many devs they're what we spend most time reading.
-foreground $field_fg -arrowcolor $scroll_arrow -arrowsize $arrow_size \ | ||
-highlightthickness 1 -highlightcolor $focused -highlightbackground $unfocused | ||
ttk::style map TCombobox -background [list active $control_active disabled $base_bg readonly $control_readonly] | ||
ttk::style map TCombobox -fieldbackground [list active $field_bg disabled $field_bg readonly $field_bg] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was really hard to get right; setting it using ttk::style configure TCombobox -fieldbackground
just doesn't work.
|
||
set arrow_size $scale | ||
|
||
ttk::style theme use alt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default
also works pretty well. I prefer the slightly more 3D look of alt
, but the main reason to use it is that it makes the settings of checkboxes and radio buttons clearer (it was hard to get those to do the right thing with sufficient contrast in other themes).
set darkest #101010 | ||
set darker #242424 | ||
set dark #303030 | ||
set darkish #404040 | ||
set lightish #484848 | ||
set light #585858 | ||
set lighter #686868 | ||
set lightest #808080 | ||
set white #e0e0e0 | ||
set whiter #f0f0f0 | ||
set whitest #ffffff | ||
|
||
set scale 18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users of this fork: feel free to adjust these for accessibility. I'll probably add "high contrast" and "larger controls" settings.
ttk::style theme use alt | ||
|
||
ttk::style configure TFrame -background $base_bg \ | ||
-highlightthickness 1 -highlightcolor $focused -highlightbackground $unfocused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The widget focus highlight is still not working quite right, and it should be made more visible, especially on buttons and checkboxes. (Also keyboard navigation on the main pane is tricky because pressing Tab in the comment area just adds a tab to the content. I can't remember ever wanting a tab in a commit comment, so that should probably be changed.)
It seems from prati0100/git-gui#44 that people are having problems with incorrect colour extraction from the system theme even in light mode. So a "Use system theme" / "Light mode" / "Dark mode" option would be useful for that as well. Also the extracted colours should probably be sanity-checked for sufficient contrast, which is necessary even to be able to see the UI to change the settings. Proposed appearance controlsColours
Tk theme: (The word "colours" is localized so will appear as "colors" in en_US locales.) How these will work:
I'll also consider adding specific colour overrides, if I have time and the Tk colour selector widgets aren't too horrible. The "Edit | Options..." dialog is already crowded, so I'm also thinking of putting these in a separate "Edit | Appearance..." dialog. There would definitely not be enough room for colour selectors in "Edit | Options...", and this gives more flexibility to add other appearance options if needed. If we also move the font settings there, it would make "Edit | Options..." more clearly focused on the behaviour of the app, rather than its appearance. Each dialog would have an independent "Restore Defaults" button. |
Based loosely on @birgersp's code at prati0100/git-gui#64 (comment).
Limitations: