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

Add Light style option to Application style #2558

Closed
ThomasBallatore opened this issue Jan 27, 2021 · 22 comments
Closed

Add Light style option to Application style #2558

ThomasBallatore opened this issue Jan 27, 2021 · 22 comments
Assignees
Labels
enhancement Feature requests. gui

Comments

@ThomasBallatore
Copy link

Describe the new feature

The new feature would add an option for "Light style" to the existing choices of "Dark style" and "Follow the desktop style" to Application style in the General tab under Preferences.

This would allow users to have their desktop style set to Dark but to still be able to use DB Browser for SQLite in Light mode.

Additional info

Please answer these questions before submitting your feature request.

Is your feature request related to an issue? Please include the issue number.

No.

Does this feature exist in another product or project? Please provide a link.

Yes. For example, Discord as shown in following screenshot.

Do you have a screenshot? Please add screenshots to help explain your idea.

Screen Shot 2021-01-27 at 22 32 09

The menu bar above shows the system is in Dark mode but the app itself is in Light mode. While I love the new Dark mode in DB Browser for SQLite when working alone, I prefer Light mode when teaching and sharing my screen but do not want to change my system settings to Light mode because I prefer other apps to stay in Dark mode.

@chrisjlocke chrisjlocke added enhancement Feature requests. gui labels Jan 27, 2021
@mgrojo
Copy link
Member

mgrojo commented Feb 1, 2021

For future reference, this would be straightforward if the following is implemented in our used style sheet: ColinDuquesnoy/QDarkStyleSheet#240

mgrojo added a commit that referenced this issue Mar 31, 2021
Thanks to a new light style provided by QDarkStyleSheet in v3.0.rc
(9eea545) we can add a new light style option.

`qdarkstyle/dark/style.qrc` had to be renamed to
`qdarkstyle/dark/darkstyle.qrc` and `qdarkstyle/light/style.qrc` to
`qdarkstyle/light/lightstyle.qrc` in order to include both as resources.

See issues:
- ColinDuquesnoy/QDarkStyleSheet#240
- ColinDuquesnoy/QDarkStyleSheet#273
- #2558
@mgrojo mgrojo self-assigned this Mar 31, 2021
@mgrojo
Copy link
Member

mgrojo commented Mar 31, 2021

Thanks to ColinDuquesnoy/QDarkStyleSheet, which provides now a light style, I could implement a new option for a light style. @ThomasBallatore could you try with tomorrow's nightly build and report any problem in your environment?

@mgrojo mgrojo added this to the 3.13.0 - Future release milestone Mar 31, 2021
@ThomasBallatore
Copy link
Author

Hey, this is great—thanks!

I tested the April 1st nightly build on my mac (MacBookPro15,3 running 20E5224a) and wanted to clarify a few things I'm seeing.

When I select Preferences | General | Application style | Follow the desktop style, I see this when my Mac is in Light mode:

Screen Shot 2021-04-02 at 16 32 30

and this when my Mac is in Dark mode:

Screen Shot 2021-04-02 at 16 33 02

In DB Browser for SQLite, when I choose Light style, I see this:

Screen Shot 2021-04-02 at 16 33 51

and for Dark style, this:

Screen Shot 2021-04-02 at 16 34 12

While these latter two certainly look nice, I guess I was hoping for an option to simply show one of the first two by selecting something like light or dark in DB Browser. One issue, esp. with the new Light style, is the lower contrast. Also, it looks like the font size got tweaked to something a bit tiny for my aging eyes.

@mgrojo
Copy link
Member

mgrojo commented Apr 2, 2021

The rationale of this is that we follow your desktop style by default and we adjust our defined colours to match the lightness or darkness of it. Additionally we provide a particular style, now in two shades, light and dark. I don't know if one can choose the native style with a different shade as the desktop. Why do you need it to be different?

Cannot the font be changed from Preferences?

@chrisjlocke
Copy link
Member

chrisjlocke commented Apr 2, 2021

There are three places to change the font sizes. There is a value on the 'general' tab of the preferences dialog

image

And on the 'data browser' tab, and one more on the 'sql' tab.

@ThomasBallatore
Copy link
Author

Ideally, what I was looking for is the ability to just keep DB Browser in Light mode even if my computer is in Dark mode. In my 4 screenshots above, that means #1, all the time. When teaching at night, I find it much better for students if I share my screen with DB Browser in Light mode (other programs are different).

#3 and #1 look quite different to me and I suspect many will prefer the nice #3 but for me, #1 is more readable.

As for font size, I'm guessing something odd happened behind the scenes with the Light style (#3)'s font size because I took these screenshots at the same time with no other settings changing.

Thanks again for all your work on this awesome product!

@chrisjlocke
Copy link
Member

As for font size, I'm guessing something odd happened behind the scenes with the Light style (#3)'s font size

Can you just confirm changing the value in the preferences changes the font size? It may be that the style isn't looking at the right value, for example.

@ThomasBallatore
Copy link
Author

Just restarted and can confirm the font size is now fine without any adjustment. Just a glitch in the matrix before!

@chrisjlocke
Copy link
Member

and we adjust our defined colours

@mgrojo - I don't know how Qt works, but do we say 'use dark theme' and set the colours for each component/widget explicitly, or just tell Qt to use 'light' and 'dark' and it does what it wants?
Was thinking along the lines of having 'palettes' where users could define exactly what colours are for each component, and allow downloading them as required. In ye olde Windows for example. we had this:

image

This was globally across all applications, but it could be good to define something for DB4S along these lines? That way, 'dark mode' could be anything the user wanted - bit darker, bit lighter, etc...

@chrisjlocke
Copy link
Member

Just restarted and can confirm the font size is now fine

Thanks for confirming! 👍

@mgrojo
Copy link
Member

mgrojo commented Apr 2, 2021

@mgrojo - I don't know how Qt works, but do we say 'use dark theme' and set the colours for each component/widget explicitly, or just tell Qt to use 'light' and 'dark' and it does what it wants?

When we set 'Dark style' or 'Light style, we use https://github.com/ColinDuquesnoy/QDarkStyleSheet/, which is a style-sheet that sets the colors and appearance for all the widgets, except for the colours of the data browser and SQL editor. Since we let the user configure those, we have to adjust them to dark or light combinations, when the general style is selected. In the 'Follow Desktop' setting we have to discover whether it's light or dark, in order to adjust those configurable colours to the style (so the user always get good defaults). This is what I was referring to.

Was thinking along the lines of having 'palettes' where users could define exactly what colours are for each component, and allow downloading them as required. In ye olde Windows for example. we had this:

This was globally across all applications, but it could be good to define something for DB4S along these lines? That way, 'dark mode' could be anything the user wanted - bit darker, bit lighter, etc...

I suppose it could be done, but I suppose it's going too far. Maybe for the editor, we could define different selectable themes, like many editors do, but the majority of applications do not allow changing the widget style independently.

@mgrojo
Copy link
Member

mgrojo commented Apr 2, 2021

While these latter two certainly look nice, I guess I was hoping for an option to simply show one of the first two by selecting something like light or dark in DB Browser. One issue, esp. with the new Light style, is the lower contrast. Also, it looks like the font size got tweaked to something a bit tiny for my aging eyes.

Maybe you can force the light mode using OS ways. In this commit we reverted the previous forcing of the light mode for macOS (till then we had some problems with the dark mode):

0bb3b23

Maybe you can change that file yourself without recompiling? I'm not sure since I don't know macOS.

And in this article, it seems that you can exclude some application from the dark mode:
https://www.techjunkie.com/exclude-app-dark-mode-macos-mojave/

@mgrojo mgrojo modified the milestones: 3.13.0 - Future release, 3.12.2 Apr 2, 2021
@rafrafek
Copy link
Contributor

rafrafek commented Nov 8, 2021

Follow the desktop style does not change theme to dark on my windows 10 machine, when system is set to dark.

@chrisjlocke
Copy link
Member

chrisjlocke commented Nov 8, 2021

@rafrafek - What version of DB4S are you using? Have you tried with the nightly version at all?
When you say 'change' do you mean dynamically change the theme? Have you restarted DB4S after changing the desktop style? If you change the desktop style, DB4S won't immediately flip themes.

@rafrafek
Copy link
Contributor

rafrafek commented Nov 8, 2021

What version of DB4S are you using?

3.12.2

Have you tried with the nightly version at all?

I'm sorry, I didn't try the nightly version.

When you say 'change' do you mean dynamically change the theme?

It doesn't work dynamically.

Have you restarted DB4S after changing the desktop style?

Yes, and it doesn't work after DB4S restart.

If you change the desktop style, DB4S won't immediately flip themes.

All the other apps I use do the flip immediately. It would be a nice option.

@chrisjlocke
Copy link
Member

All the other apps I use do the flip immediately

All? Notepad doesn't. ;)

Considering it's job is to maintain databases, it seems weird it'd have to waste CPU cycles determining if the user has changed from light to dark theme. Do you switch themes often then?

@rafrafek
Copy link
Contributor

rafrafek commented Nov 8, 2021

All? Notepad doesn't. ;)

I don't use notepad. I use VS Code, PyCharm, Outlook, Edge, Firefox etc., all of them change theme automatically.

Considering it's job is to maintain databases, it seems weird it'd have to waste CPU cycles determining if the user has changed from light to dark theme.

Can you just subscribe to system event or something like that?

Do you switch themes often then?

Twice a day. Light in the morning, dark in the evening.

@chrisjlocke
Copy link
Member

Can you just subscribe to system event or something

Qt is cross platform, so it's whether it passes on information from macOS, Windows or a plethora of Linux distributions.

The issue is tagged as an enhancement already, so hopefully it can be looked into.
Thanks for raising it! :)

@mgrojo
Copy link
Member

mgrojo commented Jan 2, 2022

I've discovered a problem with the dark and light styles (not the desktop style) and I'll add it here, since it is still open. A second click in a column to revert the sort order causes the column headers to disappear. The problem disappears with a refresh.

I returned to d123fc9 in order to know if the last changes were responsible, but no, it is something older, maybe after the stylesheet update for this issue.

@justinclift
Copy link
Member

Ouch. Good catch though @mgrojo. 😄

mgrojo added a commit that referenced this issue Jun 15, 2022
This happened only for the custom dark/light styles.

The new connects fixes the issue for me. This was discovered by trial and
error, because I don't know what is really causing the problem (seems
some bug relating with event ordering and maybe a race condition).

Second change is irrelevant for the issue, just for optimization of the
loop.

See comment:
#2558 (comment)
@mgrojo
Copy link
Member

mgrojo commented Jun 15, 2022

The problem I mentioned should be fixed now, at least it's working for me.

#2558 (comment)

@justinclift
Copy link
Member

Excellent effort @mgrojo! 😄

mgrojo added a commit that referenced this issue Oct 14, 2023
This happened only for the custom dark/light styles.

The new connects fixes the issue for me. This was discovered by trial and
error, because I don't know what is really causing the problem (seems
some bug relating with event ordering and maybe a race condition).

Second change is irrelevant for the issue, just for optimization of the
loop.

See comment:
#2558 (comment)
mgrojo added a commit that referenced this issue Nov 11, 2023
This fixes at least a problem in display of combo-boxes.

Updated following instructions in:
https://github.com/ColinDuquesnoy/QDarkStyleSheet/tree/v3.2.1#c

- Related issue: #2558.
- Issue still present (no difference in toggled buttons in menus): #1899.
@mgrojo mgrojo closed this as completed Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. gui
Projects
None yet
Development

No branches or pull requests

5 participants