Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· openaiHugging Face Suzhen/CodeChat

In my linux xfce desktop I am using adwaita-dark as my theme, but I don't like the color…

  1. User

    In my linux xfce desktop I am using adwaita-dark as my theme, but I don't like the color of the disabled text, since the wxSYS_COLOUR_GRAYTEXT of applications get invisible since the background color is similar. What I did as a workaround is change the /usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc file changing this:

    gtk-color-scheme = "text_color:white\nbase_color:#232729"

    to this:

    gtk-color-scheme = "text_color:white\nbase_color:#394146"

    and now I can see the letters again, but I want to know if there is a different way to do this, like changing the disabled text color only instead of changing the entire Text/base color of the theme?

  2. Assistant

    Yes, there is a different way to adjust just the disabled text color. You can modify the gtkrc file for the Gtk+ 2 theme or the corresponding CSS file for Gtk+ 3 to alter only the disabled text color. Gtk+ 2 and Gtk+ 3 have different theming engines, so you will need to modify both if your applications use a mix of Gtk+ 2 and Gtk+ 3.

    Here's how you can update both Gtk+ 2 and Gtk+ 3 themes:

    For Gtk+ 2 (like the file you've already edited):

    1. Open the gtkrc file you've previously modified: /usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc.

    2. Look for the style "default" section or a style section for disabled text.

    3. Add or modify the fg[STATE] parameter, where STATE is INSENSITIVE for disabled text. The color scheme line you modify might look something like this:

      fg[INSENSITIVE] = "#A1A1A1"  # Example color for disabled text
      

      You should choose a color that gives you better visibility for disabled text.

    For Gtk+ 3:

    1. Open the corresponding CSS file, usually found in /usr/share/themes/Adwaita-dark/gtk-3.0/gtk.css.

    2. Look for a CSS rule that applies to disabled text, which might look something like this:

      .textview text:disabled,
      .entry:disabled,
      .label:disabled {
          color: #A1A1A1; /* Example color for disabled text */
      }
      

      Replace #A1A1A1 with a suitable color that improves the visibility of disabled text.

    After making these changes, you may need to restart your applications or even log out and log back in for the changes to take effect.

    Important Note: It is generally not recommended to edit theme files directly in /usr/share/themes/ because your changes will be lost when the theme is updated. Instead, it's better to copy the entire theme folder (e.g., Adwaita-dark) to ~/.themes/ in your home directory and rename it. Then, apply your modifications to the copied theme and select it from your theme settings. This way, your changes will persist across updates to the system theme.

    Example:

    cp -r /usr/share/themes/Adwaita-dark ~/.themes/MyCustomAdwaitaDark
    

    Edit files in ~/.themes/MyCustomAdwaitaDark and then select "MyCustomAdwaitaDark" as your theme using your desktop environment's appearance settings.

  3. User

    In my gtkrc file I don't have that, I have this:

  4. Assistant

    It seems like the gtkrc file in your theme doesn't explicitly define a color for disabled (insensitive) text if you haven't found the specific fg[INSENSITIVE] line. Depending on the version of the theme and how it's written, it might inherit the insensitive text color from another style or it could be relying on default settings.

    In Gtk+ 2, you can try adding an insensitive text color definition to the theme by creating a style specifically for insensitive text. If there’s not already a style defined for it, you can add one to the gtkrc file.

    Here's what you can do:

    1. Open ~/.themes/MyCustomAdwaitaDark/gtk-2.0/gtkrc with a text editor.

    2. Create a new style block or update an existing one that is meant for defining text colors. For example:

      style "insensitive-text" {
          fg[INSENSITIVE] = "#A1A1A1"  # Example color for disabled text
      }
      class "GtkWidget" style "insensitive-text"
      
    3. Adjust #A1A1A1 to the hex color value that you'd like for your insensitive (disabled) text.

    By applying this style to "GtkWidget", which is a base class for all widgets, it will attempt to change the insensitive text color globally across the theme.

    Please remember to always work on a copy of the theme in your home directory under ~/.themes/ rather than modifying system files directly. You then have to select this custom theme through your desktop environment's appearance settings.

    After applying the changes and selecting the new theme, you might need to restart the affected applications or re-log to see the changes.

    For Gtk+ 3 themes, you would need to add or edit the CSS selectors for insensitive text in the gtk.css file inside your ~/.themes/MyCustomAdwaitaDark/gtk-3.0/ directory.

    Do keep in mind that not every application may obey the Gtk+ theme color definitions, especially if the application is not a native Gtk+ app or does something non-standard with its text rendering.

  5. User

    Based on Bridge by ScionicSpectre

    vim:set ts=2 sw=2 sts=2 ai et:

    This is the GTK+ 2 version of Adwaita. It's whole purpose is to look as the

    GTK+ 3 version as much as possible until GTK+ 2 dies completely.

    Note: comments for explaining styles are on the bottom of each file beside the

    widget matches.

    Declare the colours used throughout the theme.

    There shouldn't be any fiddling with them in the theme files themselves in

    order to not mess up the dark theme.

    Text/base original: base_color:#232729

    gtk-color-scheme = "text_color:white\nbase_color:#394146"

    Foreground/background

    gtk-color-scheme = "fg_color:#eeeeec\nbg_color:#33393b" # Selected foreground/background gtk-color-scheme = "selected_fg_color:#ffffff\nselected_bg_color:#215d9c"

    Insensitive foreground/background

    gtk-color-scheme = "insensitive_fg_color:#919494\ninsensitive_bg_color:#2d3234"

    Menus

    gtk-color-scheme = "menu_color:#262b2d"

    Links

    gtk-color-scheme = "link_color:#4a90d9\nvisited_link_color:#2a76c6"

    Treeview headers

    gtk-color-scheme = "column_header_color:#898b8b\nhover_column_header_color:#bcbdbc"

    Window decoration

    gtk-color-scheme = "window_color:#2c3133"

    Tooltips

    gtk-color-scheme = "tooltip_fg_color:#ffffff\ntooltip_bg_color:#343434"

    Set GTK settings

    gtk-auto-mnemonics = 1 gtk-primary-button-warps-slider = 1

    And hand over the control to the theme files

    include "main.rc" include "apps.rc" include "hacks.rc" include "hacks-dark.rc"

  6. Assistant

    The content you've shared shows that the gtkrc file from the Adwaita-dark theme already defines various color schemes, including one for insensitive (disabled) text, insensitive_fg_color. To adjust the disabled text color only, you only need to modify the value assigned to insensitive_fg_color in the gtk-color-scheme definition.

    Here is the line you need to modify:

    # Insensitive foreground/background
    gtk-color-scheme = "insensitive_fg_color:#919494\ninsensitive_bg_color:#2d3234"
    

    You can change #919494 to a color that will make insensitive text more visible on your theme's background. Here's an example of doing that:

    # Insensitive foreground/background, with modified text color
    gtk-color-scheme = "insensitive_fg_color:#A1A1A1\ninsensitive_bg_color:#2d3234"
    

    In this example, #A1A1A1 is the new color for the insensitive text that should provide better contrast. Choose any color that you prefer and replace it accordingly.

    Once you update the value, save the file and restart any open applications to apply the new theme settings, or you can log out and log back in.

    Remember to:

    1. Create a copy of the theme in ~/.themes/ before making changes.
    2. Modify the files in the copied theme directory.
    3. Apply the changes by choosing your customized theme from the system's appearance settings.

    This way, the changes will apply only to the insensitive (disabled) text color without affecting the base or text color for the rest of your theme.

  7. User

    That's the problem, check the color it already has: it is a light color #919494, but I still see it dark in the application. I changed that and It didn't changed the application itself. The application is codeblocks and this is what the developer said about this bug:

    It is. The cause is, that we use wxSYS_COLOUR_GRAYTEXT for not compilable/linkable files, like nonpch-headers, xml-files etc.

    It should be used for disabled text (as the wxWidgets docu says), but for wxGTK they create it as 2/3 of wxSYS_COLOUR_3DFACE. And 2/3 of black is black.

    Code case wxSYS_COLOUR_GRAYTEXT: case wxSYS_COLOUR_BTNSHADOW: //case wxSYS_COLOUR_3DSHADOW: { wxColour faceColour(GetColour(wxSYS_COLOUR_3DFACE)); color = wxColour((unsigned char) (faceColour.Red() * 2 / 3), (unsigned char) (faceColour.Green() * 2 / 3), (unsigned char) (faceColour.Blue() * 2 / 3)); } break;

  8. Assistant

    The problem you're facing seems to be related to how wxWidgets (the library used by Code::Blocks) interprets system colors on GTK-based systems. According to the developer's response, wxWidgets computes wxSYS_COLOUR_GRAYTEXT by taking two-thirds of the color value of wxSYS_COLOUR_3DFACE, which in turn might be linked to one of the theme's colors.

    The relevant system colors (like wxSYS_COLOUR_GRAYTEXT) are typically fetched directly from the GTK theme. However, wxWidgets seems to be applying a specific calculation to derive wxSYS_COLOUR_GRAYTEXT, which may not always correspond with the intended appearance of the Gtk+ theme.

    To address this, you have a couple of options:

    1. Change the wxSYS_COLOUR_3DFACE Equivalent in GTK: If you can identify the GTK color corresponding to wxSYS_COLOUR_3DFACE, you could try altering that to a lighter color, so when wxWidgets computes the two-thirds value, it still retains sufficient contrast. Yet, this might be a bit tricky and could affect other widgets and parts of your theme as well.

    2. Override wxWidgets Behavior (Advanced/Developer Approach): This would involve modifying the Code::Blocks source code (if open to you and you have the skills) in a way that directly sets the color you want for wxSYS_COLOUR_GRAYTEXT instead of taking two-thirds of another color. You would then need to recompile Code::Blocks with these modifications.

    3. Contact wxWidgets or Code::Blocks Developers: You could report this issue to the developers of wxWidgets or Code::Blocks, as the way they are calculating wxSYS_COLOUR_GRAYTEXT seems to not cater to dark themes very well. There may be a chance they provide a fix or a suggested workaround if many users are affected.

    4. Custom Compile wxWidgets: If you have the technical expertise, you could alter the wxWidgets library code on your system that calculates the wxSYS_COLOUR_GRAYTEXT value and then recompile your application against the modified wxWidgets. This is quite advanced and potentially affects all applications that use wxWidgets, so it's a less common approach.

    Unfortunately, all of these solutions are non-trivial and involve a deeper dive than simple theme adjustments. Since the issue lies more with how wxWidgets computes this specific system color than with the GTK theme itself, modifying the GTK theme's colors might not give you the desired outcome.

    Lastly, if you're not keen on modifying system libraries or application code, your best bet might still be to continue using your current workaround or see if other themes may not have this issue with Code::Blocks.

  9. User

    I checked the wxSYS_COLOUR_3DFACE, this is what the docs say:

    wxSYS_COLOUR_3DFACE Synonym for wxSYS_COLOUR_BTNFACE. wxSYS_COLOUR_BTNFACE Face shading colour on push buttons.

    So it seems to be related to the buttons color or something, also I checked with Pinta, the color of the string displayed in the app and seems to be from this range #232B34 - #25323F

  10. Assistant

    Based on your findings and the wxWidgets documentation, wxSYS_COLOUR_3DFACE (or wxSYS_COLOUR_BTNFACE) seems to be related to the button face color in the GTK theme. The Adwaita-dark theme does not directly map this to GTK's own system color names, and wxWidgets may be using a different method to derive it, possibly from bg_color.

    The fact that the color you sampled from Code::Blocks falls into the range #232B34 - #25323F implies that it is indeed dark, and this might be close to your theme's bg_color as defined:

    # Foreground/background
    gtk-color-scheme = "fg_color:#eeeeec\nbg_color:#33393b"
    

    This suggests that the button face color (wxSYS_COLOUR_3DFACE) that wxWidgets is referring to might be equivalent to the bg_color in GTK2, and if wxWidgets is doing a 2/3 scale of this color for wxSYS_COLOUR_GRAYTEXT, it will indeed result in a color that is too dark relative to the overall dark theme.

    If your intention is to adjust the color within the theme files so that Code::Blocks shows a lighter color for wxSYS_COLOUR_GRAYTEXT, you might consider changing bg_color to a lighter shade. However, this would affect other aspects of your theme where bg_color is used, possibly leading to an undesirable appearance.

    Given what you've described, one option is to specifically address the computation within wxWidgets, but as described earlier, that's a non-trivial task. Since changing bg_color has broad impacts and may not be desirable, you may want to consider reporting this issue to the wxWidgets or Code::Blocks community for a more sustainable long-term fix.

    It's important to reaffirm that if you prefer not to modify the theme globally, you will have to live with the workaround you've found, adjust individual application settings if possible, or wait for/support a fix within the wxWidgets framework.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.