Christian Wahl

SVG as background in Ubuntu Desktop

04 Jun 2020 • Christian Wahl

Ok, this is not something new, but I just installed Ubuntu 20.04 on my new laptop and in that process I dusted off my background image for the desktop.

Since Windows 2000 I have always use a neutral background for my desktop: The blue color on Windows and later a solid blue color on Ubuntu with Unity. And since Ubuntu switched to Gnome an image with either a solid blue color or a gradient.

The blue background:

After the switch to Gnome I quickly found out that a SVG could be used as a background image. This is my current version:

<?xml version="1.0"?>
<svg viewBox="0 0 16 9" xmlns="http://www.w3.org/2000/svg">
  <defs>
    <linearGradient id="g1" gradientTransform="rotate(90)">
      <stop offset="0" stop-color="SteelBlue"/>
      <stop offset="1" stop-color="Black"/>
    </linearGradient>
  </defs>
  <rect width="16" height="9" fill="url(#g1)"/>
</svg>

I like the simplicity: Setting the aspect ratio of the screen in the view box, using named colors for the gradient, and setting the rectangle to fill the entire space.