-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
98 lines (84 loc) · 4.61 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Online color picker for terminal 256 color palette. Examples for shell prompt, vim, term/xterm</title>
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="icon" href="favicon.ico">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script>
<meta property="og:url" content="https://michurin.github.io/xterm256-color-picker/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Online color picker for terminal 256 color palette. Examples for shell prompt, vim, term/xterm" />
<meta property="og:description" content="You can choose colors for 256-color terminal applications here" />
<meta property="og:image" content="https://michurin.github.io/xterm256-color-picker/og-image.png" />
</head>
<body>
<h1>Online color picker for 256 colors terminal</h1>
<div class="float-left">
<h2>global background</h2>
<table class="pal" id="gbg"></table>
<h2>text background</h2>
<table class="pal" id="bg"></table>
<h2>text color</h2>
<table class="pal" id="fg"></table>
<h2>contrast ratio <span class="contrast-ratio">xx</span></h2>
ideally, >4.5 for most terminal-sized text<br>
scale is between 1-21
</div>
<div class="float-left">
<h2>usage examples</h2>
<table><tr><td id="ex" class="pre"><b>### Just echo</b>
echo -e "\033[38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>m TEXT \033[0m"
<b>### sh/bash prompt</b>
export PS1='\[\033[38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>m\] \W \[\033[0m\] \$ '
# foreground only: export PS1='\[\033[38;5;<span class="fg-label">xx</span>m\] \W \[\033[0m\] \$ '
# background only: export PS1='\[\033[48;5;<span class="bg-label">xx</span>m\] \W \[\033[0m\] \$ '
<b>### zsh prompt</b>
PROMPT='%F{<span class="fg-label">xx</span>}%K{<span class="bg-label">xx</span>} %~ %k%f %# '
# foreground only: PROMPT='%F{<span class="fg-label">xx</span>} %~ %f %# '
# background only: PROMPT='%K{<span class="bg-label">xx</span>} %~ %k %# '
<b>### CSS</b>
color: rgb(<span class="fg-label-rgb">x, x, x</span>); /* color: #<span class="fg-label-hex">xxxxxx</span>; */
background-color: rgb(<span class="bg-label-rgb">x, x, x</span>); /* background-color: #<span class="bg-label-hex">xxxxxx</span>; */
<b>### ls/grep/less/vim/tmux...</b>
export LS_COLORS='di=38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>'
# foreground only: LS_COLORS='di=38;5;<span class="fg-label">xx</span>'
# background only: LS_COLORS='di=48;5;<span class="bg-label">xx</span>'
ls --color=always /
export GREP_COLORS='ms=38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>'
grep --color=always root /etc/passwd
export LESS_TERMCAP_md=$'\e''[38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>m'
export LESS_TERMCAP_us=$'\e''[38;5;<span class="fg-label">xx</span>;48;5;<span class="bg-label">xx</span>m'
man man
<b># vim: ~/.vimrc</b>
:highlight Normal ctermfg=<span class="fg-label">xx</span> ctermbg=<span class="bg-label">xx</span>
<b># tmux: ~/.tmux.conf line</b>
set -g status-style bg=colour<span class="bg-label">xx</span>,fg=colour<span class="fg-label">xx</span>
All these commands have a lot of options.
Take a closer look at man pages
<a
target="_blank" href="https://linux.die.net/man/1/grep">grep↗</a> <a
target="_blank" href="https://linux.die.net/man/1/tmux">tmux↗</a> <a
target="_blank" href="https://linux.die.net/man/1/dircolors">dircolors↗</a> <a
target="_blank" href="https://linux.die.net/man/5/termcap">termcap↗</a> <a
target="_blank" href="https://linux.die.net/man/5/terminfo">terminfo↗</a> <a
target="_blank" href="https://linux.die.net/man/1/bash">bash↗</a> <a
target="_blank" href="https://linux.die.net/man/1/zshmisc">zshmisc↗</a></td></tr></table>
</div>
<div class="clean pre">
--
Author: Alexey Michurin <a.michurin@gmail.com>
Contributors:
<a href="https://www.puny.agency/">Chris Rawnsley ↗</a>
Source: <a href="https://github.com/michurin/xterm256-color-picker">https://github.com/michurin/xterm256-color-picker ↗</a>
Any contributions, feedback or ideas are welcome
</div>
<h1>Appendix A: X11 color names</h1>
<table id="appendix-a">
</table>
<script src="main.js"></script>
<script src="color_utils.js"></script>
<script src="colors.js"></script>
<script src="appendix_a.js"></script>
</body>
</head>