Author Topic: Code::Blocks colors  (Read 15176 times)

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Code::Blocks colors
« on: April 06, 2020, 11:04:36 pm »
Hello,
I noticed that C::B is mixing system colors with custom hard coded default colors. This makes C::B look strange/ugly on system themes with non standard color palettes and parts of the UI unusable and some text illegible on systems with a dark theme enabled or with an inverted color palette.

You can clearly see this issue on this screenshot: https://sourceforge.net/p/codeblocks/tickets/943/attachment/Capture%20d%E2%80%99%C3%A9cran%20du%202020-04-06%2008-56-33.png

Obviously, there are two possibilities. C::B could either try to use system color theme as much as possible or use a custom theme. I think that the first option is the way to go since C::B is already using UI elements (widgets) from the platform.

There is quite some choice of system colors: https://docs.wxwidgets.org/3.1/settings_8h.html#a44ad26cbd8d579d1b7eff7015c8bd24b
A already made a patch correcting link colors in the start page: https://sourceforge.net/p/codeblocks/tickets/943/ and investigated caption text color in pane info. `wxBLACK` is hardcoded in AUI in wxWidgets: https://github.com/wxWidgets/wxWidgets/blob/master/src/aui/dockart.cpp#L330, but I have a WIP patch for C::B. I also plan to fix toolbox border and tabs.

There is still one problem though. C::B lets users change UI colors. I don't know how it should work with hybrid system themes with a white and dark mode. Color overrides will be applied regardless of the theme. Maybe C::B should have separate color options for the theme variants?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3352
Re: Code::Blocks colors
« Reply #1 on: April 06, 2020, 11:49:27 pm »
Quote
A already made a patch correcting link colors in the start page:
I have not found the patch. Have you uploaded it, or are you going to fix more, before you upload it?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #2 on: April 07, 2020, 12:43:55 am »
About defaults: Use the colour manager and just make the defaults to be using the system colours.
About notebooks: You're using gtk3 I suppose, because in gtk2 we have a native dock art, but this doesn't look possible in gtk3. I won't bother with the default aui arts, they are plain ugly and old looking. I plan to make something 100% custom. Probably reuse the work done in CodeLite or replicate the notebook in Firefox or similar. I don't know yet.
About panel names: There is a button in the settings to auto-detect the colours after a theme change, so I'm not sure what you want to change there.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #3 on: April 07, 2020, 08:29:36 am »
> I have not found the patch. Have you uploaded it, or are you going to fix more, before you upload it?

Sorry. I forgot the patch in the ticket.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #4 on: April 07, 2020, 10:37:39 am »
I'll take a look soon.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #5 on: April 07, 2020, 10:38:52 am »
Hmmm... They have a thing called `wxAUI_DOCKART_BORDER_COLOUR`, doc says it's a border https://docs.wxwidgets.org/trunk/group__group__class__aui.html#ggab09190c5a3f9cd3628819fbe93a9caa0a3c097368a59117ad699f4201e14f5fb6, but it seems like `SHADOW` is what it really is. They made a shadow and called it border. As you can see on the attached screenshot, it's only possible to control right and bottom border color. Top and left are hardcoded to white: https://github.com/wxWidgets/wxWidgets/blob/master/src/aui/dockart.cpp#L553

@oBFusCATed Why do you want to do something 100% custom? Do you think that it won't be possible to fix AUI upstream?

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #6 on: April 07, 2020, 10:41:13 am »
I think that the best temporary fix for this will be to default border size to `0`. It looks very nice without that border.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #7 on: April 07, 2020, 07:31:07 pm »
1. Keep in mind that we ship on 3 OSes and there are million different gtk2 themes.
2. We don't use wxAuiToolbar so looking at the auidemo is not 100% representative.
3. In gtk2 we had our own dock art for notebooks which had been upstreamed and it is available in wxgtk. It uses native gtk apis for drawing notebook elements, so the look is native to the them. With gtk3 there is no api to do the same. So we have to do something which suits the look of C::B. I doubt it makes sense to upstream it. We could try, but it would be yet another tabart.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #8 on: April 07, 2020, 08:30:32 pm »
2. C::B is affected by the same issue. Where is that code in C::B then?

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #9 on: April 07, 2020, 11:35:58 pm »
3. Now GTK4 is in development. This API could be proposed as it might be useful to other apps and IDEs.
GTK is not the only backend. I saw C:B on Windows and it's equally ugly. Since those platforms are supported, it must be drawn anyway and OS X also has a dark theme.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #10 on: April 07, 2020, 11:59:49 pm »
3. Now GTK4 is in development. This API could be proposed as it might be useful to other apps and IDEs.
You can try. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #11 on: April 08, 2020, 11:26:19 pm »
What's actually missing in GTK3? It has a notebook with tabs. It's used by many apps. Notably Epiphany, Gedit, Terminal and Gajim.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #12 on: April 09, 2020, 12:04:03 am »
APIs to make this work: https://github.com/obfuscated/codeblocks_sf/blob/master/src/src/notebookstyles.cpp#L485
If you find one let me know and I'll spend some time implementing this for gtk3.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline mimi89999

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: Code::Blocks colors
« Reply #13 on: April 09, 2020, 09:29:52 am »
I'm not sure which part you are referring to exactly, but if it's tab styling, that's possible in GTK3 with CSS. Please see these resources:
https://developer.gnome.org/gtk3/stable/theming.html
https://thegnomejournal.wordpress.com/2011/03/15/styling-gtk-with-css/
https://developer.gnome.org/gtk3/stable/gtk-migrating-GtkStyleContext-checklist.html
https://www.preining.info/blog/2020/03/de-uglify-gtk3-tabs-of-terminals/

I was able to style tabs as you can see on the screenshot.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Code::Blocks colors
« Reply #14 on: April 09, 2020, 10:00:02 am »
The task is to use the tab styling of the gtk 3 theme, not draw random stuff on tabs.
If you want to see how it works - build yourself a wx with gtk2 and test different themes with the aui demo.
If we want to draws something we won't use css for sure :) We don't need it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]