Menu

#239 Support for configuring terminal colors

v1.0 (example)
open
None
4
2018-01-16
2014-10-01
No

I've created a patch which allows the colors of the terminal to be changed.
It could be applied to PAC using patch:

---SNIP---
$ patch -p1 < /path/to/TerminalColors.patch
---SNAP---

It adds GTK+ color buttons to "Preferences" --> "Terminal Options" --> "Look and Feel" --> "Terminal UI". Settings are persisted to PAC's configuration as all the other options. If you run the patched version for the first time, colors are set to default values (the same as in the "Tango" color scheme of "gnome-terminal") and persisted to config at the next config-save.

When you change colors and confirm the settings dialog, colors are immediately applied to all open terminal windows.

Bonus: As I've used GTK+ color chooser buttons, you could drag and drop colors from elsewhere (e.g. "gnome-terminal" preferences).

---+ Possible enhancements
A "reset" defaults button, in case you messed something up.
Multiple predefined color schemes like in gnome-terminal, selectable via a drop down menu

I'm using this patch since over a year now and I apply it to all new releases and never had any issues so I assume it is tested quite well.

1 Attachments

Discussion

  • Magnus Eriksson

    Magnus Eriksson - 2015-03-17

    This patch generally works fine, but when starting a local shell after the patch has been applied the text is partly black-on-black, for example file names in the output from "ls -l" (default Linux Mint 17 settings).

    When PAC is started from another terminal, this is seen:

    Use of uninitialized value in subroutine entry at /opt/pac/lib/PACTerminal.pm line 3271.

    I have patched this file myself for other things, so line numbers does not match, but the cause is quite obviously that the color config has not yet been set.
    Line 3271 in my PACTerminal.pm is this one:

    my $colors = [Gtk2::Gdk::Color -> parse($$self{_CFG}{'defaults'}{'color black'}), # black

    Simple workaround is to edit the colors once, at (Global) Preferences -> Terminal Options -> Look and Feel -> Colors -> "black", and save config.
    After this the patch works just fine.

    /Magnus

     
  • Magnus Eriksson

    Magnus Eriksson - 2015-09-27

    Attached patch adds the missing initialization of default values for the colors.
    With this it should work also before the first color change.
    /Magnus

     
  • Andr1an

    Andr1an - 2016-03-03

    Here you are, full patch. Just cd /opt/ or where is your installation and patch -b -p1 < TerminalColors_v2.patch, it will also backup original files for you.

     

    Last edit: Andr1an 2016-03-03
  • Pablo Sanchez

    Pablo Sanchez - 2017-06-12

    Works nice, thanks

     
  • honghe

    honghe - 2018-01-16
    Works fine, Thanks!
    
     

Log in to post a comment.