texstudio-org / texstudio

TeXstudio is a fully featured LaTeX editor. Our goal is to make writing LaTeX documents as easy and comfortable as possible.
http://www.texstudio.org/
GNU General Public License v3.0
2.83k stars 345 forks source link

Unify Settings for Themes #2653

Open geolta opened 2 years ago

geolta commented 2 years ago

Currently, the settings for the look of UI elements and the editor are scattered about multiple settings: Style, Color Scheme, Ignore Most System Colors and Syntax Highlighting. I suggest that all these styles get unified into themes. A theme would consist of a style for syntax highlighting and a style for the UI elements and the user only select a theme. Creating own themes would be possible of course.

This would make it much easier to apply a consistent style fitting your taste to TexStudio, especially for users who are not that familiar with all the available options.

Keeping the settings for Syntax Highlighting separated from the style for the UI elements would also be possible.

What do you think about such change?

sunderme commented 2 years ago

I would not mix syntax highlighting with the rest. Not sure what a "style" exactly should do, there are already profiles to change various settings.

geolta commented 2 years ago

With "style" I mean the look (=mainly colors, but rounded corners, etc. are also possible) of UI elements, e.g. buttons, text fields, etc.

And currently, the mentioned settings even all use the same function (QApplication.setStyle() and qApp->setStyleSheet()) to achieve a change of the style of UI elements. Also, only a few hard-coded themes are currently available, which would be changed by implementing this feature.

But you're right, syntax highlighting and the rest of the UI elements are different and should be handled differently. Therefore, I would split the implementation of this feature into themes for UI elements and themes for syntax highlighting what is already possible via profiles.

Therefore I also prefer using TexStudio-profile files to store syntax highlighting themes since they're flexible and already integrated. The main difference regarding syntax highlighting would be that I'd suggest having a couple of themes preinstalled and a combo box to choose the theme.

sunderme commented 2 years ago

There is maybe a misunderstanding. In the Qt world, style is provided as plugin to specify widget appearance. txs provides the basic ones, but the system may provide more, most promimently adwaita-qt can be installed and used on linux.

The color scheme should actually be a style but it can be combined with other styles. An point for improvement may be to get rid of that in favor of a (pseudo-) style. The other option are rather fall-back options if something appears odd.

Summary: I don't think we should abstract themes further as it is mainly already set in styles. The color scheme can be ditched in favor of a pseudo-style.

geolta commented 2 years ago

Are you referring to the appearance of widgets or only the code editor if you are talking about the pseudo styles?

But anyways I can totally understand that introducing new styles (in the Qt world meaning) wouldn't lead to a great benefit. Actually, my initial reason to open this issue was the ability to have color schemes, I extended this idea afterwards. When looking on the screen for hours, what can easily happen if you're writing a long text, colors fitting your personal needs are quite important. What do you think about reducing back to colors only?

Technically, this would mean a change of QPalette. Currently, this is done when checking the option Ignore most system colors and neither Adwaita nor Orion Dark are selected as Style. My modified idea now would be to extend this checkbox to multiple options like "Solarized", "Dark", etc., including "Use System Colors".

But one question remains for me: Where is the technical difference between what you can select in the Style and the Color Scheme combo boxes? That the styles available in Color Scheme are specific to TexStudio?

sunderme commented 2 years ago

I would suggest to do color scheme via style sheets. It can do more, but changing colors should also be possible. (https://texstudio-org.github.io/background.html#style-sheets)

geolta commented 2 years ago

Okay, I'm currently implementing a draft, a PR will be there in the next weeks.

geolta commented 1 year ago

Hi, I'm currently implementing this feature, but fighting with multiple interferences between my code and other aspects of styling like dark mode, palette manipulations, custom user style sheets, etc.

The problem is as follows: The user has the following options to change aspects of the style of TXS (excluding syntax highlighting):

Each option of this list manipulates either QStyle, QStyleSheet or QPalette (or multiple of them). Furthermore, the variable darkMode is calculated and based on this variable, even more manipulations are done.

So when changing something, this leads to inconsistencies – what brings me back to my initial idea of unifying the settings for theming.

The problem is though, I think, that this would be a larger change in the code base as well as in the experience. I'm not really sure whether this is desired by the community.

geolta commented 1 year ago

To be more specific, my "vision" would be breaking the theming down to only two settings: The "Style" would be kept, but the other options would be unified into one "Color Scheme" option (what would be implemented with QStyleSheet or QPalette).

Do you think, this is feasible?

sunderme commented 1 year ago

I would rather go away from the idea of "color scheme". It was used for manhattan style which can be mixed with different window styles. adwaita and similar (kvantum) just set everything and thus guarantee a consistent set-up. So, first step -> move manhantan/manhattan dark into styles ?

geolta commented 1 year ago

Yes, indeed the Manhattan style is not only a color scheme, it also modifies paddings, etc. Therefore the name "color scheme" is at least misleading. But moving it into the styles is – as far as I know – not that easy because it's a QProxyStyle and not a QStyle. It modifies other styles but is not a standalone one.

If you ask me, I would rather remove the Manhattan style – it's an unmaintained piece of code with – I would guess – only few users. If not remove it, I would at least rename it from "Color Scheme" to something like "Style Modifier".

Besides this, I think, this issue can be closed. Color Schemes and the Manhattan Style are topics for separate issues.

sunderme commented 1 year ago

I would rather handle it as a pseudo style.

geolta commented 1 year ago

What do you exactly mean with "pseudo style"? The default style plus the Manhattan style?

sunderme commented 1 year ago

Call it in the GUI manhattan style and then set what is necessary (i.e. default style plus ...)