gedit-plugin-markdown_preview icon indicating copy to clipboard operation
gedit-plugin-markdown_preview copied to clipboard

Automatically inherit theme & color style changes from Gedit

Open nekohayo opened this issue 3 years ago • 4 comments

Kind of a pony wishlist here, but it would be great if this plugin could automatically inherit my Gedit color theme setting (ex: "Oblivion"), and stay connected with a signal/API/dbus/whatever to changes to that setting so that when it is changed in the gedit preferences, it is automatically applied/refreshed in the markdown preview plugin.

One of the reasons I'm asking for this is that I have my own little tool that changes Gedit's color scheme to "Oblivion" at night and "Tango" during daytime :)

nekohayo avatar Jun 21 '21 15:06 nekohayo

ok you should have say #36 here, because the solution of this color style thing is clearly to replace the "enable css" switch by a bunch of radio buttons:

  • don't add css
  • use css from the gedit color-scheme
  • use a custom css file

then adding some fat colored border-left to the blockquote tags is possible when this 2nd option is chosen

maoschanz avatar Jun 21 '21 19:06 maoschanz

Personally I'm thinking that less options is better and that if possible the app/extension should try to guess what's best, so inherit the theme/style colors from gedit but allow overriding it with CSS if the user really cares. So it becomes just one option: Custom CSS on top of the inherited style, or not. On/Off, basically.

nekohayo avatar Jun 21 '21 22:06 nekohayo

So if the user doesn't want CSS, they should... override it with an empty file? What a counter-intuitive hack. A group of radio buttons corresponds to a single setting, so it's still one option, and it's less ridiculous.

maoschanz avatar Jun 22 '21 07:06 maoschanz

So if the user doesn't want CSS, they should... override it with an empty file?

No, I don't think I have said that, especially not in this way of saying it.


Technically now you don't necessarily need to follow gedit's setting, you could also follow the system one, as nowadays there is also standardized way for your app to authoritatively know (without just trying to "guess" whether the current GTK theme is dark or not) what the user's intent is in terms of light/dark themes, at the system level.

  • Overview here: https://blogs.gnome.org/alexm/2021/10/04/dark-style-preference/
  • Implementation tips here: https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/Dark-Style-Preference

Most applications already support this with GNOME 42+ and Elementary OS 6, even non-purely-GTK applications such as Firefox. I believe lots of applications on KDE support this standard as well.

In this particular case I'm not sure which approach is best: inheriting the color scheme from gedit, or going straight to the source at the system's preference. Gedit hasn't implemented this approach yet.

For apps that offer the user a choice whether to follow the system theme or not, an example of a commonly used UI for this in GTK and GNOME apps is the screenshot you can see here: https://github.com/mjakeman/extension-manager/issues/218

nekohayo avatar Dec 03 '22 15:12 nekohayo