banner



How To Give Text A Background Color In Unity

All we need is an like shooting fish in a barrel explanation of the problem, so hither it is.

In a lot of applications the tooltips are just manifestly ugly (White text on blackness background, way too much contrast) or even unreadable (black or dark bluish text (Hyperlinks) on black background). I desire to modify the background color of the tooltips to some medium gray or even some yellow or something like that, maybe even something semi-transparent.

Here is a screenshot of Eclipse which displays some source code in a tool tip with black text on black background:

Eclipse with an unusable tooltip

Switching to a different theme (Something other than Ambiance or Radiance) helps but I like Ambiance and I want to go on information technology. Information technology's just this darn tooltip color which is absolutely unacceptable.

I institute several solutions for older Ubuntu versions but they no longer piece of work with Unity in Ubuntu xi.10 considering I can't observe whatsoever function to customize the Ambiance or Radiance theme. So how do I do that in the electric current Ubuntu version?

How to solve :

I know you bored from this bug, So we are here to assistance you! Take a deep breath and look at the caption of your problem. We have many solutions to this problem, Only nosotros recommend you lot to use the first method considering it is tested & true method that will 100% piece of work for you.

Method i

Install and open gnome-color-chooser Install gnome-color-chooser.

Go to SpecificTooltips and put blackness foreground over stake yellow background.

Method ii

Constitute it!

I had to edit these files:

          /usr/share/themes/Ambiance/gtk-3.0/settings.ini /usr/share/themes/Ambiance/gtk-3.0/gtk.css /usr/share/themes/Ambiance/gtk-2.0/gtkrc                  

(Improver: for Ubuntu 12.04, information technology seems youjust have to modify the file:
/usr/share/themes/Ambiance/gtk-2.0/gtkrc , replacing the tooltip backround and foreground colour, with the #000000 and the #f5f5b5 color, respectively)

Y'all require root privileges to edit the files. Use gksudo gedit to edit them.

Search for tooltip in these files and you'll find the color definitions for the foreground and the background. I employ #000000 every bit foreground and #f5f5b5 as background and now the tooltips in all applications are once again readable. After changing the color values only switch to some other theme and so back to Ambiance and the tooltip color is now fixed.

Here is the result:

Eclipse with customized theme

Method 3

If you want to modify the tooltip colors for all apps then install and run gnome-colour-chooser and go to Specific tab > Tooltips. Check the boxes for Foreground and Background and choose colors.

How information technology works (you can do this manually):

gnome-color-chooser adds the following to your ~/.gtkrc-2.0:

          include ".gtkrc-2.0-gnome-color-chooser"                  

and ~/.gtkrc-ii.0-gnome-chooser:

          style "gnome-color-chooser-tooltips" {   bg[NORMAL] = "#FFFFAF"   fg[NORMAL] = "#000000" } widget "gtk-tooltip*" style "gnome-colour-chooser-tooltips"                  

If you but want to change the tooltip colors for a single app, such as eclipse, then put the above text into a custom gtkrc file (e.g. ~/gtkrc-eclipse) and start eclipse with GTK2_RC_FILES=~/gtkrc-eclipse eclipse

Method 4

I created a small script that does that for you

          #/bin/sh # Tooltip fix # A script to gear up themes files in Ubuntu eleven.10 #  to accept readable tooltips in applications such #  as eclipse. # The script edits the gtk.css, settings.ini and gtkrc files # Author: Victor Pillac # http://victorpillac.wordpress.com  if [[ $EUID -ne 0 ]]; and so   echo "This script must be run as root" ane>&ii   exit ane fi    path=/usr/share/themes theme=Ambiance  if [ $# = 1 ]; then   theme=$1 fi  echo "Fixing tooltips for theme $theme" echo " (you lot tin select a different theme by passing its name as argument)" sed -i 's/tooltip_bg_color #000000/tooltip_bg_color #f5f5b5/g' $path/$theme/gtk-three.0/gtk.css sed -i 's/tooltip_fg_color #ffffff/tooltip_fg_color #000000/1000' $path/$theme/gtk-iii.0/gtk.css sed -i 's/tooltip_bg_color:#000000/tooltip_bg_color:#f5f5b5/g' $path/$theme/gtk-3.0/settings.ini sed -i 's/tooltip_fg_color:#ffffff/tooltip_fg_color:#000000/chiliad' $path/$theme/gtk-3.0/settings.ini sed -i 's/tooltip_bg_color:#000000/tooltip_bg_color:#f5f5b5/1000' $path/$theme/gtk-2.0/gtkrc sed -i 'southward/tooltip_fg_color:#ffffff/tooltip_fg_color:#000000/g' $path/$theme/gtk-ii.0/gtkrc echo "Done"                  

Method 5

I've adopted a slightly different solution;

First create a new script, eclipse.sh, that starts eclipse, mine look like this:

          #!/bin/bash GTK2_RC_FILES=/usr/share/eclipse/gtkrc-2.0-eclipse /usr/share/eclipse/eclipse                  

Then create the gtkrc file (/usr/share/eclipse/gtkrc-ii.0-eclipse), mine look like this (it have some other changes as well to brand better apply of the screen):

          mode "my-tooltips" {   bg[NORMAL] = "#FFFFAF"   fg[NORMAL] = "#000000" } widget "gtk-tooltip*" fashion "my-tooltips"  mode "gtkcompact"  {     font_name="Ubuntu Light 11"      GtkButton::default_border={0,0,0,0}     GtkButton::default_outside_border={0,0,0,0}     GtkButtonBox::child_min_width=0     GtkButtonBox::child_min_heigth=0     GtkButtonBox::child_internal_pad_x=4     GtkButtonBox::child_internal_pad_y=4     GtkMenu::vertical-padding=1     GtkMenuBar::internal_padding=0     GtkMenuItem::horizontal_padding=four     GtkToolbar::internal-padding=i     GtkToolbar::space-size=1     GtkOptionMenu::indicator_size=0     GtkOptionMenu::indicator_spacing=0     GtkPaned::handle_size=four     GtkRange::trough_border=0     GtkRange::stepper_spacing=0     GtkScale::value_spacing=0     GtkScrolledWindow::scrollbar_spacing=0     GtkExpander::expander_size=10     GtkExpander::expander_spacing=0     GtkTreeView::vertical-separator=0     GtkTreeView::horizontal-separator=0     GtkTreeView::expander-size=x     GtkTreeView::fixed-height-way=Truthful     GtkWidget::focus_padding=0     GtkTreeView::vertical-separator = 0 }  course "GtkWidget" style "gtkcompact"  style "gtkcompactextra"  {     xthickness=0     ythickness=0 }  grade "GtkButton"   fashion "gtkcompactextra" course "GtkToolbar"  style "gtkcompactextra" class "GtkPaned"    style "gtkcompactextra" class "GtkNotebook" style "gtkcompact"                  

Method 6

For CDT practice the following:

Window>Preferences>C/C++>Editor: Appearance Color Options>Source Hover Background

Uncheck System Default, and select a color.

Unfortunately at that place'southward no Eclipse-broad setting that I know of. Pretty lame. You shouldn't take to set stuff similar that for every perspective.

Method 7

I think this 1 is solved. I got it showing the tooltip with black letters on white background. In my case, it seems that Eclipse is using settings fot tooltips from gtk-2.0/gtkrc file from theme directory.

My setup: Ubuntu 12.04, Gnome (Not Unitiy), Eclipse Indigo (three.seven), GrayDay theme for Gnome. The name of theme and theme itself is not importat.

Open up the terminal, change to the theme directory (cd $Home/.themes) and there, go to the directory of your theme. If your .themes direcotry if empty of it doesn't exist, then, you are using organisation theme which is in /usr/share/themes. Merely effigy out the name of the theme you are using (correct click on bakcground, choose Alter Desktop Background, the theme name should be in the lower right corner. If it says nothing most theme name, then use gnome-tweak-tool to find out which theme y'all are using).

In the theme directory, issue this control:

          grep -r tooltip *                  

it should list all of the files and lines where keywork "tooltip" is mentioned. Change every background (tooltip_bg_color) to #ffffff and every foreground to #000000. Blackness latters on white foreground, this is what we want! Especially, change values in the gtk-two.0/gtkrc file.

Mistake I was doing, is chainging tooltip color in the gtk-3.0 directory, which didn't have whatsoever effect.

Now, get to the Eclipse, Window -> Preferences -> Java -> Editor and set Source Hover Background to the "Organisation colour" (check on the right). Restart the Eclipse!

This is listig of grep -r tooltip * from my theme directory after doing changes:

          gtk-2.0/gtkrc:gtk-color-scheme  = "tooltip_fg_color:#000000\ntooltip_bg_color:#ffffff\nlink_color:#0033ff" gtk-2.0/gtkrc:style "tooltips" { gtk-2.0/gtkrc:  bg[NORMAL]  = @tooltip_bg_color gtk-2.0/gtkrc:  fg[NORMAL]  = @tooltip_fg_color gtk-2.0/gtkrc:  GtkWidget::new-tooltip-style    = 0 gtk-2.0/gtkrc:# The window of the tooltip is chosen "gtk-tooltip" gtk-2.0/gtkrc:widget "gtk-tooltip*"             style "tooltips" gtk-three.0/gtk.css:/* @define-color tooltip_bg_color #343434; */ gtk-3.0/gtk.css:/* @define-colour tooltip_fg_color #ffffff; */ gtk-three.0/gtk.css:@ascertain-color tooltip_bg_color #ffffff; gtk-iii.0/gtk.css:@define-colour tooltip_fg_color #343434; gtk-three.0/gtk.css:@define-color theme_tooltip_bg_color @tooltip_bg_color; gtk-3.0/gtk.css:@define-color theme_tooltip_fg_color @tooltip_fg_color; gtk-3.0/gtk-widgets.css:.tooltip { gtk-3.0/gtk-widgets.css:    groundwork-color:   @theme_tooltip_bg_color; gtk-3.0/gtk-widgets.css:    color:              shade(@theme_tooltip_fg_color, 0.xc); gtk-iii.0/gtk-widgets.css:.tooltip * { gtk-3.0/gtk-widgets.css:    background-color: @theme_tooltip_bg_color; gtk-3.0/settings.ini:gtk-color-scheme   = "tooltip_fg_color:#343434\ntooltip_bg_color:#ffffff\nlink_color:#4a90d9" gtk-3.0/settings-default.ini:gtk-color-scheme   = "tooltip_fg_color:#343434\ntooltip_bg_color:#ffffff\nlink_color:#4a90d9"                  

Method 8

There is also another solution to this:
apply dconf-editor to find the following key:

          org->gnome->desktop->interference->gtk-color-scheme                  

whose clarification said:
A \n separated list of proper noun:color as defined past the gtk-color-scheme setting.

Write the scheme in gedit in the way likes the post-obit(this example is mine), then paste it in the dconf-editor(find the '\n' at each stop of the line):

          fg_color:#4c4c4c4c4c4c bg_color:#f2f2f1f1f0f0 text_color:#3c3c3c3c3c3c base_color:#ffffffffffff selected_fg_color:#ffffffffffff selected_bg_color:#f0f077774646 tooltip_fg_color:#ffffff5a0e74 tooltip_bg_color:#14a784edd8b6                  

and the problem volition exist solved immediately.

Method 9

My tooltips are black-on-yellow. See screenshot below from Ubuntu 16.04 LTS with MATE DE:

Black-on-Yellow tooltip

If you like such color combination, use 2 gtkrc (1 for GTK3, 1 for GTK2) files below:

          mkdir -p ~/.config/gtk-3.0/ cat << EOF >> ~/.config/gtk-iii.0/gtk.css /* tooltips */ @define-colour tooltip_bg_color #ffffaf; @ascertain-color tooltip_fg_color #000000; tooltip characterization, .tooltip label {     text-shadow: none; } EOF cat << EOF >> ~/.config/gtk-3.0/settings.ini [Settings] gtk-color-scheme = "tooltip_bg_color:#ffffaf\ntooltip_fg_color:#000000" EOF  cat << EOF >> ~/.gtkrc-two.0 style "gnome-color-chooser-tooltips" {   bg[NORMAL] = "#FFFFAF"   fg[NORMAL] = "#000000" } widget "gtk-tooltip*" style "gnome-color-chooser-tooltips" EOF                  

The tertiary file is only for GTK2-based applications.

The method in a higher place was tested on Ubuntu 14.04 LTS (Unity and GNOME), Ubuntu 16.04 LTS (Unity, GNOME, MATE), Ubuntu 18.04 LTS (Unity, GNOME, MATE), Ubuntu 20.04 LTS (MATE).

Method 10

I was having aforementioned problem (Xubuntu 12.04, Greybird theme, Eclipse Indigo) and Mihael K's answer worked for me.
The just file I changed was gtk-2.0/gtkrc and I only changed one line.
The third line after the initial comments. Changed the hex color values of tooltip_bg_color:#000000 to tooltip_bg_color:#ffffe1 and tooltip_fg_color:#ffffff to tooltip_fg_color:#000000. Then the line will wait like this:

          gtk_color_scheme        = "tooltip_bg_color:#ffffe1\ntooltip_fg_color:#000000" # Tooltips.                  

Restarted elipse and tooltips are now the yellowish color I'grand accustomed to. I didn't need to exercise any farther tweaks in eclipse or any of the other files.

Method 11

On ubuntu 12.10 (quantal) y'all can utilize the post-obit two commands:

          #foreground white => black sudo sed -i s/tooltip_fg_color:#ffffff/tooltip_fg_color:#000000/g  /usr/share/themes/Ambiance/gtk-3.0/settings.ini /usr/share/themes/Ambiance/gtk-3.0/gtk.css /usr/share/themes/Ambiance/gtk-2.0/gtkrc #background black => yellow sudo sed -i south/tooltip_bg_color:#000000/tooltip_bg_color:#f5f5b5/one thousand  /usr/share/themes/Ambiance/gtk-3.0/settings.ini /usr/share/themes/Ambiance/gtk-iii.0/gtk.css /usr/share/themes/Ambiance/gtk-2.0/gtkrc                  

(Cheers to the other answers that helped me to figure this out!!)

Method 12

A more user-friendly manner to change the background is using the UI. Open System, Preferences, Advent. By default "Ambiance" theme will exist selected, but you can modify information technology for any theme. Click on Customize button below and switch to Colors tab. In that location yous can change foreground and background colors for tooltips by clicking on appropriate boxes.

Method 13

This answer is to point out a rare case where a very similar bug occurs if you have installed xulrunner and configured eclipse to use it.

I installed xulrunner to brand the GPE Designer to properly return GWT UIs in the design mode, which worked very well simply I found it also broke the tooltips. The issues is actually worse than the screenshot in a higher place, it just display a blank tooltip.

To ready it you only have to remove the xulrunner parameter from eclipse.ini:

          -Dorg.eclipse.swt.browser.XULRunnerPath=/path/to/xulrunner/                  

It worked for me with Ubuntu 12.04, Eclipse 4.2/Juno and xulrunner 1.9.2

Method xiv

For elementary users:

Become to /usr/share/themes/elementary/gtk-3.0, edit the file gtk-widgets.css with sudo nano, type Ctrl + West to find Tooltips, and and then at the background-color: blastoff(#color, #opacity) modify the color to something like #f5f5b5 and gear up opacity to 1.

Method 15

To open up Appearance window with Tab: Themes directly from [email protected] terminal write (you can use this control likewise for script):

          sudo -u USER gnome-appearance-properties -p theme                  

where USER is your electric current user on the desktop. It will open Appearance correctly, only you still need to click on theme displays in Appearance window to launch your theme.

For the examination with install theme: Dust from [email protected] terminal, command:

          sudo -u USER gnome-appearance-properties -i /home/USER/Desktop/Dust-0.iv.tar.gz                  

gets this error:

(gnome-appearance-properties:16161): Gtk-Alarm **: Unable to locate theme engine in module_path: "murrine"

but if theme: Dust is installing by chosing carte: System/Preferences/Appearance and installs from Appearance window , installation of the theme: Dust is right.

At that place is needed control responsible for choosing themes in Appearance window, but I can't notice it.

Method sixteen

I'm running Kubuntu 16.04 with the Breeze theme, and Eclipse iv.half-dozen.1 with the default GTK3 now that they've fixed the button padding upshot.

To reach hover tooltips with low-cal grayness groundwork and black foreground I made a few changes to /usr/share/themes/Breeze-gtk/gtk-iii.0/gtk.css; here's what I ended up with:

          /************  * Tooltips *  ************/ .tooltip {   colour: #000000;   padding: 4px;   box-shadow: none; } .tooltip.background {     background-color: #f5f5f5;     background-clip: padding-box;     border: 1px solid rgba(255, 255, 255, 0.1); }                  

And the original:

          /************  * Tooltips *  ************/ .tooltip {   color: white;   padding: 4px;   /* non working */   edge-radius: 5px;   box-shadow: none;   text-shadow: 0 1px blackness; }   .tooltip.background {     background-color: rgba(0, 0, 0, 0.8);     groundwork-prune: padding-box;     edge: 1px solid rgba(255, 255, 255, 0.one); }                  

In example links aren't working in Javadoc popups, it may help to install libwebkitgtk like so:

          sudo apt install libwebkitgtk-1.0-0                  

Note: Employ and implement method ane because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa four.0

How To Give Text A Background Color In Unity,

Source: https://getridbug.com/ubuntu/how-to-change-tooltip-background-color-in-unity/

Posted by: owenscrind1984.blogspot.com

0 Response to "How To Give Text A Background Color In Unity"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel