summaryrefslogtreecommitdiff
path: root/README.rst
blob: 2631ac838f1c8d178f3e8da6f76ec67b215f7aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
###############################################################################
                                     VTCOL
###############################################################################

Change the color scheme (and more) of the virtual Linux console.

Color schemes
-------------------------------------------------------------------------------

Use ``vtcol colors`` to manipulate the console palette.

.. image:: ./doc/img/solarized.png

**vtcol** loads color schemes from various source: From a set of predefined
palettes, from a binary dump or by loading it from a definition file. The
latter supports input in the format used by setcolors_. (Not much effort has
been put into ensuring compliance so YMMV.) Check the subdirectory
``./schemes`` in the **vtcol** tree for examples of definition files.

Four color schemes are predefined:

    * ``default``          the default color scheme of the Linux console.
    * ``solarized``        the Solarized_ color scheme, dark version.
    * ``solarized_light``  the Solarized_ color scheme, light version.
    * ``phosphor``         monochrome green text on black background.

Invoke **vtcol** with the ``set`` command specifying the scheme of your
choice: ::

    $ vtcol colors set solarized_light

Or for a more 80s look’n’feel: ::

    $ vtcol colors set phosphor

.. image:: ./doc/img/phosphor.png

In order to view the available schemes, use the ``list`` command. Should the
scheme specified not resolve to one of the predefined ones, **vtcol** will fall
back on interpreting the name as that of a file. Likewise, loading a scheme
directly from a definition file is accomplished by specifying the ``--file``
argument to ``set``. ::

    $ vtcol colors set --file ./schemes/solarized

Instead of an actual scheme or file name, these parameters accept ``-``
as an argument in order to read from ``stdin``. ::

    $ vtcol colors set -

To show the current scheme of the active console use the ``get`` subcommand: ::

    $ vtcol colors get
    solarized_dark

With the ``-base64`` switch ``vtcol`` outputs a binary representation of color
schemes: ::

    $ vtcol colors get --base64
    ACs23DIvhZkAtYkAJovS0zaCKqGY7ujVACs2y0sWWG51ZXuDg5SWbHHEk6Gh/fbj

which can then be re-applied with ``vtcol set``::

    $ vtcol colors set --base64 \
        ACs23DIvhZkAtYkAJovS0zaCKqGY7ujVACs2y0sWWG51ZXuDg5SWbHHEk6Gh/fbj

It is also possible to use vtcol to switch between two themes by means of the
``toggle`` subcommand. E. g. to cycle between “dark mode” and “light mode”: ::

    $ vtcol colors toggle solarized solarized_light

To view a scheme’s definition, for instance in order to verify that **vtcol**
parses it correctly, use the ``dump`` command. ::

    $ vtcol colors dump default
    $ vtcol colors dump ./schemes/solarized

This will print the color definitions contained in the scheme; if the specified
name does not resolve to a pre-defined scheme it will be interpreted as a file
name instead.

Keyboard LEDs and flags
-------------------------------------------------------------------------------

Keyboard handling is grouped under the ``vtcol kb`` subcommand.

Show the current state of the keyboard LEDs: ::

    $ vtcol kb leds get
    caps: false, num: true, scroll: false

Set the state of the Caps Lock LED (does *not* affect the Caps Lock state, just
the LED itself): ::

    $ vtcol leds set --caps on

Likewise for the keyboad state (*not* the LEDs):  ::

    $ vtcol kb flags get
    [flags: caps: false, num: false, scroll: false; default: caps: false, num: false, scroll: false]


Building
-------------------------------------------------------------------------------

Use Cargo to obtain a binary: ::

    $ cargo build --features=vtcol-bin

To generate the manpage, run ::

    $ make man

*rst2man* from the *Docutils* suite needs to be installed for this.

Background
-------------------------------------------------------------------------------

The default palette that comes with a Linux terminal was inherited from a long
history of virtual console implementations. The colors assigned were chosen for
pragmatic reasons but that palette may not harmonize with everybody’s taste.
Enter **vtcol**.

**vtcol** attempts to make the console colors themeable with a simple plain
text input format. The very popular themes from the Solarized_ family are
included as predefined palettes; the same is true of the Linux default palette,
so they can be conveniently restored when experimenting.

About
-------------------------------------------------------------------------------

The **vtcol** source code is available from the `canonical repository`_.
**vtcol** is redistributable under the terms of the `GNU General Public
License`_ version 3 (exactly). Patches or suggestions welcome.

.. _setcolors:                  https://github.com/EvanPurkhiser/linux-vt-setcolors
.. _Solarized:                  http://ethanschoonover.com/solarized
.. _GNU General Public License: http://www.gnu.org/licenses/gpl.txt
.. _canonical repository:       https://gitlab.com/phgsng/vtcol