Active Line in Text Editor Unreadable in Ubuntu 20.04 Dark Mode [Workaround]

For dark mode fans, you may found the color scheme in Gedit Text Editor is not so good! Focused line is not even readable due to the light text on light line background.

There’s already an upstream fix, though it’s not made into current Ubuntu releases. There are however workarounds and I’m going to show you how!

Option 1.) Use another color scheme:

There are a few other built-in color schemes available in the default Gedit text editor.

Firstly, open the editor and go to ‘Preferences’ in the hamburger menu. While Ubuntu defaults to the ‘Classic’ colors, you can then choose another from Font & Colors tab.

And new colors take places immediately!

Option 2.) Hack the current line background color:

Sticking to the default color scheme? It’s easy to hack the xml config file to change the current line background.

1.) Firstly, open terminal either from system app launcher or by pressing Ctrl+Alt+T on keyboard.

2.) When terminal opens, run command to edit the xml:

sudo gedit /usr/share/gtksourceview-4/styles/classic.xml

Type user password (no visual feedback) when it asks and hit Enter. When file opens, scroll down to find out and change the background value of ‘current-line’ and ‘current-line-number’.

NOTE: If you stick to dark mode, color #181818 is great! However, it’s not good in light mode. So if you switch between light and dark mode regularly, use another color value, such as #99999c.

After saving the changes, the color will take place in new app window.