Btop tema färger: ändra färger i .theme-filen

Btop tema färger: ändra färger i .theme-filen
Btop är en systemövervakare för Linux och macOS som visar processor, minne, nätverk och processer i terminalen. Ett av de mest synliga sätten att anpassa btop är genom teman. Ett tema styr vilka färger som används för grafer, lådor, text och bakgrund. I den här artikeln går vi igenom hur btop hanterar temafärger, var .theme-filen ligger och hur du skapar ett eget färgtema.
Hur btop väljer tema
I konfigurationsfilen btop.conf finns inställningen color_theme. Den anger namnet på det .theme-fil som btop ska använda. Som standard står den inställd på Default, vilket är det inbyggda standardtemat.
Du kan ändra inställningen själv genom att öppna btop.conf och skriva namnet på ett annat tema. Btop letar efter temat i flera mappar i följd. Den första mappen som finns och inte är tom används:
../share/btop/themes(relaterat till btop-körfilen)/usr/local/share/btop/themes/usr/share/btop/themes
Om ingen av systemmapparna finns eller är tomma letar btop i användarens temamapp. Den beror på vilka miljövariabler som är satta:
- Om
$XDG_CONFIG_HOMEär satt:$XDG_CONFIG_HOME/btop/themes - Annars, om
$HOMEär satt:$HOME/.config/btop/themes - Annars:
~/.config/btop/themes
När du kör make install placeras standardteman i systemmappen. Teman som du själv skapar ska du lägga i användarmappen så att de inte skrivs över vid en uppdatering.
Vad en .theme-fil innehåller
En .theme-fil är en textfil som styr btop:s färger. Btop använder samma temaformat som bpytop och bashtop. Filen innehåller attribut som bestämmer färg för olika delar av gränssnittet — till exempel grafer, lådor, text och bakgrund.
Några inställningar som hör samman med temats utseende finns direkt i btop.conf:
theme_background = true— avgör om temat sätter bakgrundsfärgen eller om terminalens egen bakgrund syns.truecolor = true— aktiverar 24-bitars färger (truecolor). Om det är avstängt omvandlas färger till 256-färgsläget.
De nya funktionerna för att pausa och följa processlistan har också gett nya temaattribut, till exempel proc_pause_bg som styr bakgrundsfärgen på banderollen när processlistan är pausad.
Färgväljaren i praktiken
Btop har ingen grafisk färgväljare där du klickar dig fram till en nyans. I stället väljer du färger genom att redigera .theme-filen i en vanlig texteditor. Varje färg anges som ett namn eller ett värde som terminalen förstår.
När du vill byta färger gör du så här:
- Öppna den .theme-fil du vill ändra, eller skapa en ny i din användartemamapp.
- Ändra färgattributen för de element du vill anpassa.
- Spara filen.
- Se till att
color_themeibtop.confpekar på ditt tema. - Starta om btop så att ändringarna träder i kraft.
Om du vill testa ett tema utan att det påverkar systemet kan du använda kommandoradsalternativet --themes-dir. Det pekar ut en egen mapp som btop söker i först, före standardmapparna.
Skapa ett eget färgtema steg för steg
Så skapar du ett eget tema med egna färger:
- Skapa mappen
~/.config/btop/themesom den inte finns. - Skapa en ny fil, till exempel
mitt-tema.theme, i mappen. - Kopiera ett befintligt tema som mall så att du får med alla nödvändiga attribut.
- Ändra färgerna för de delar du vill anpassa — till exempel färg på CPU-grafik, minnesgrafik, nätverksgrafik, processlistan och bakgrund.
- Spara filen.
- Öppna
btop.confoch ändracolor_theme = "mitt-tema". - Starta om btop.
Om något ser fel ut kan du alltid byta tillbaka till Default i btop.conf och starta om.
Vanliga misstag
Ett vanligt misstag är att lägga det egna temat i en systemmapp istället för användarmappen. Då riskerar temat att försvinna nästa gång btop uppdateras eller ominstalleras. Lägg alltid egna teman i ~/.config/btop/themes.
Ett annat misstag är att glömma uppdatera color_theme i btop.conf. Även om .theme-filen finns på rätt plats används den inte förrän konfigurationsfilen pekar på den.
Om färger ser konstiga ut kan det bero på att truecolor är avstängt. Då omvandlas 24-bitars färger till 256-färgsläget, vilket kan göra att nyanser ser annorlunda ut än du tänkt.
Länkar till fler guider
Om du vill komma igång med btop från grunden finns vår installationsguide för btop. För att förstå hur konfigurationsfilen är uppbyggd i sin helhet, läs vår guide till btop.conf.
Sammanfattning
Btop:s temafärger styrs av .theme-filer som du redigerar i en texteditor. Systemteman ligger i systemmappar, egna teman i ~/.config/btop/themes. Vilket tema som används bestämmer du med color_theme i btop.conf. Med en egen .theme-fil kan du anpassa färgerna på grafer, lådor, text och bakgrund precis som du vill ha dem.
Btop theme colors: change colors in the .theme file
Btop is a system monitor for Linux and macOS that shows CPU, memory, network and processes in the terminal. One of the most visible ways to customize btop is through themes. A theme determines which colors are used for graphs, boxes, text and background. In this article we go through how btop handles theme colors, where the .theme file is located and how to create your own color theme.
How btop chooses a theme
In the configuration file btop.conf there is the setting color_theme. It specifies the name of the .theme file that btop should use. By default it is set to Default, which is the built-in standard theme.
You can change the setting yourself by opening btop.conf and writing the name of another theme. Btop looks for the theme in several directories in order. The first directory that exists and is not empty is used:
../share/btop/themes(relative to the btop executable)/usr/local/share/btop/themes/usr/share/btop/themes
If none of the system directories exist or are empty, btop looks in the user's theme directory. It depends on which environment variables are set:
- If
$XDG_CONFIG_HOMEis set:$XDG_CONFIG_HOME/btop/themes - Otherwise, if
$HOMEis set:$HOME/.config/btop/themes - Otherwise:
~/.config/btop/themes
When you run make install, the default themes are placed in the system directory. Themes that you create yourself should be placed in the user directory so that they are not overwritten during an update.
What a .theme file contains
A .theme file is a text file that controls btop's colors. Btop uses the same theme format as bpytop and bashtop. The file contains attributes that determine the color for different parts of the interface — for example graphs, boxes, text and background.
Some settings that are related to the theme's appearance are directly in btop.conf:
theme_background = true— determines whether the theme sets the background color or whether the terminal's own background shows.truecolor = true— enables 24-bit colors (truecolor). If it is turned off, colors are converted to 256-color mode.
The new features for pausing and following the process list have also given new theme attributes, for example proc_pause_bg which controls the background color of the banner when the process list is paused.
The color chooser in practice
Btop has no graphical color picker where you click your way to a shade. Instead, you choose colors by editing the .theme file in a regular text editor. Each color is specified as a name or a value that the terminal understands.
When you want to change colors, do it like this:
- Open the .theme file you want to change, or create a new one in your user theme directory.
- Change the color attributes for the elements you want to customize.
- Save the file.
- Make sure
color_themeinbtop.confpoints to your theme. - Restart btop so that the changes take effect.
If you want to test a theme without it affecting the system, you can use the command-line option --themes-dir. It points out a custom directory that btop searches first, before the standard directories.
Create your own color theme step by step
Here is how to create your own theme with your own colors:
- Create the directory
~/.config/btop/themesif it does not exist. - Create a new file, for example
mitt-tema.theme, in the directory. - Copy an existing theme as a template so that you get all necessary attributes.
- Change the colors for the parts you want to customize — for example color for CPU graph, memory graph, network graph, process list and background.
- Save the file.
- Open
btop.confand changecolor_theme = "mitt-tema". - Restart btop.
If something looks wrong you can always switch back to Default in btop.conf and restart.
Common mistakes
A common mistake is to put your own theme in a system directory instead of the user directory. Then the theme may disappear the next time btop is updated or reinstalled. Always put your own themes in ~/.config/btop/themes.
Another mistake is forgetting to update color_theme in btop.conf. Even if the .theme file is in the right place, it is not used until the configuration file points to it.
If colors look strange it may be because truecolor is turned off. Then 24-bit colors are converted to 256-color mode, which can make shades look different than you intended.
Links to more guides
If you want to get started with btop from scratch, there is our installation guide for btop. To understand how the configuration file is structured in its entirety, read our guide to btop.conf.
Summary
Btop's theme colors are controlled by .theme files that you edit in a text editor. System themes are located in system directories, your own themes in ~/.config/btop/themes. Which theme is used you decide with color_theme in btop.conf. With your own .theme file you can customize the colors of graphs, boxes, text and background exactly as you want them.
Relaterade artiklar

Btop .theme-fil: frågor och svar om ditt anpassade tema
Allt du behöver veta om btop .theme-fil: var den sparas, hur du redigerar den manuellt och hur du byter tema utan att starta om btop.
Läs artikeln
Btop tangentbordsgenvägar färgval: Skapa ditt eget .theme-fil-tema
Lär dig hur du använder btop tangentbordsgenvägar färgval för att snabbt anpassa färger i ditt eget tema och spara resultatet i en färdig .theme-fil.
Läs artikeln
Btop kortkommandon tangentbord – Effektiv systemövervakning
Lär dig de viktigaste btop kortkommandon tangentbord för snabb navigation och kraftfull systemövervakning.
Läs artikeln
Btop färgväljare: skapa eget tema med .theme-fil
Lär dig använda btop färgväljare för att skapa ett eget tema och spara det som en färdig .theme-fil som du kan återanvända på alla dina Linux-datorer.
Läs artikeln