first push of my config files
[my-dotfiles.git] / bin / vt-color-scheme.py
CommitLineData
fdd76fc5 1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Usage:
5# 1. Save as `vt-color-scheme.py`
6# 2. Make executable
7# 3. Go to https://terminal.sexy and make your own color scheme
8# 4. Export as JSON (easier to work with) and edit TANGO_SCHEME
9# with the colors you chose
10# 5. Run this script (redirect to text file if it's easier for you)
11# 6. Paste the output as boot option in Lilo / Elilo etc.
12
13KERNEL_PARAMS = ['vt.default_red', 'vt.default_grn', 'vt.default_blu', ]
14
15# MATERIAL DARK theme
16# https://material-ui.com/customization/default-theme/
17TANGO_SCHEME = [
18 "#303030",
19 "#d32f2f",
20 "#388e3c",
21 "#f57c00",
22 "#303f9f",
23 "#c51162",
24 "#1976d2",
25 "#bdbdbd",
26 "#424242",
27 "#e57373",
28 "#81c784",
29 "#ffb74d",
30 "#7986cb",
31 "#ff4081",
32 "#64b5f6",
33 "#f5f5f5"
34 ]
35
36def color_scheme_to_rgb_channel_data(color_scheme):
37 """
38 [ '#r1g1b1', '#r2g2b2', ... ] => [ [r1, r2, ...], [g1, g2, ...], [b1, b2, ...], ]
39 """
40
41 def split_to_rgb(color):
42 # rgb str -> [red, green, blue]
43 hex_value = int(color, 16)
44 return [hex_value >> 16 & 255, hex_value >> 8 & 255, hex_value & 255]
45
46 return zip(*[split_to_rgb(color.strip('#')) for color in color_scheme])
47
48
49def prepare_param(param, channel_data):
50 return '{param}={values}'.format(param=param, values=','.join(hex(byte) for byte in channel_data))
51
52
53def main(colors):
54 print(' '.join(prepare_param(param, channel) for param, channel in \
55 zip(KERNEL_PARAMS, color_scheme_to_rgb_channel_data(colors))))
56
57
58if __name__ == '__main__':
59 main(TANGO_SCHEME)