如何在HTML / jquery中为Linux终端生成256个调色板

我希望在网站上生成Linux终端使用的调色板.我已经看到了Linux终端使用的一些调色板示例,如本网站所示 –

http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux#256%20%288-bit%29%20Colors

这些颜色是否被任意选择?或者有没有办法让我复制这个调色板.
我已经创建了一个生成调色板矩形的jquery函数,我只需要知道如何设置每个矩形的颜色以匹配Linux终端调色板.

解决方法:

为了将来参考,这是映射表.取自MicahElliott/colortrans.py

 # Primary 3-bit           # Equivalent "bright" versions
 00 = 000000               08 = 808080
 01 = 800000               09 = ff0000
 02 = 008000               10 = 00ff00
 03 = 808000               11 = ffff00
 04 = 000080               12 = 0000ff
 05 = 800080               13 = ff00ff
 06 = 008080               14 = 00ffff
 07 = c0c0c0               15 = ffffff

# Extended color palette
 16 = 000000              124 = af0000
 17 = 00005f              125 = af005f
 18 = 000087              126 = af0087
 19 = 0000af              127 = af00af
 20 = 0000d7              128 = af00d7
 21 = 0000ff              129 = af00ff
 22 = 005f00              130 = af5f00
 23 = 005f5f              131 = af5f5f
 24 = 005f87              132 = af5f87
 25 = 005faf              133 = af5faf
 26 = 005fd7              134 = af5fd7
 27 = 005fff              135 = af5fff
 28 = 008700              136 = af8700
 29 = 00875f              137 = af875f
 30 = 008787              138 = af8787
 31 = 0087af              139 = af87af
 32 = 0087d7              140 = af87d7
 33 = 0087ff              141 = af87ff
 34 = 00af00              142 = afaf00
 35 = 00af5f              143 = afaf5f
 36 = 00af87              144 = afaf87
 37 = 00afaf              145 = afafaf
 38 = 00afd7              146 = afafd7
 39 = 00afff              147 = afafff
 40 = 00d700              148 = afd700
 41 = 00d75f              149 = afd75f
 42 = 00d787              150 = afd787
 43 = 00d7af              151 = afd7af
 44 = 00d7d7              152 = afd7d7
 45 = 00d7ff              153 = afd7ff
 46 = 00ff00              154 = afff00
 47 = 00ff5f              155 = afff5f
 48 = 00ff87              156 = afff87
 49 = 00ffaf              157 = afffaf
 50 = 00ffd7              158 = afffd7
 51 = 00ffff              159 = afffff
 52 = 5f0000              160 = d70000
 53 = 5f005f              161 = d7005f
 54 = 5f0087              162 = d70087
 55 = 5f00af              163 = d700af
 56 = 5f00d7              164 = d700d7
 57 = 5f00ff              165 = d700ff
 58 = 5f5f00              166 = d75f00
 59 = 5f5f5f              167 = d75f5f
 60 = 5f5f87              168 = d75f87
 61 = 5f5faf              169 = d75faf
 62 = 5f5fd7              170 = d75fd7
 63 = 5f5fff              171 = d75fff
 64 = 5f8700              172 = d78700
 65 = 5f875f              173 = d7875f
 66 = 5f8787              174 = d78787
 67 = 5f87af              175 = d787af
 68 = 5f87d7              176 = d787d7
 69 = 5f87ff              177 = d787ff
 70 = 5faf00              178 = d7af00
 71 = 5faf5f              179 = d7af5f
 72 = 5faf87              180 = d7af87
 73 = 5fafaf              181 = d7afaf
 74 = 5fafd7              182 = d7afd7
 75 = 5fafff              183 = d7afff
 76 = 5fd700              184 = d7d700
 77 = 5fd75f              185 = d7d75f
 78 = 5fd787              186 = d7d787
 79 = 5fd7af              187 = d7d7af
 80 = 5fd7d7              188 = d7d7d7
 81 = 5fd7ff              189 = d7d7ff
 82 = 5fff00              190 = d7ff00
 83 = 5fff5f              191 = d7ff5f
 84 = 5fff87              192 = d7ff87
 85 = 5fffaf              193 = d7ffaf
 86 = 5fffd7              194 = d7ffd7
 87 = 5fffff              195 = d7ffff
 88 = 870000              196 = ff0000
 89 = 87005f              197 = ff005f
 90 = 870087              198 = ff0087
 91 = 8700af              199 = ff00af
 92 = 8700d7              200 = ff00d7
 93 = 8700ff              201 = ff00ff
 94 = 875f00              202 = ff5f00
 95 = 875f5f              203 = ff5f5f
 96 = 875f87              204 = ff5f87
 97 = 875faf              205 = ff5faf
 98 = 875fd7              206 = ff5fd7
 99 = 875fff              207 = ff5fff
100 = 878700              208 = ff8700
101 = 87875f              209 = ff875f
102 = 878787              210 = ff8787
103 = 8787af              211 = ff87af
104 = 8787d7              212 = ff87d7
105 = 8787ff              213 = ff87ff
106 = 87af00              214 = ffaf00
107 = 87af5f              215 = ffaf5f
108 = 87af87              216 = ffaf87
109 = 87afaf              217 = ffafaf
110 = 87afd7              218 = ffafd7
111 = 87afff              219 = ffafff
112 = 87d700              220 = ffd700
113 = 87d75f              221 = ffd75f
114 = 87d787              222 = ffd787
115 = 87d7af              223 = ffd7af
116 = 87d7d7              224 = ffd7d7
117 = 87d7ff              225 = ffd7ff
118 = 87ff00              226 = ffff00
119 = 87ff5f              227 = ffff5f
120 = 87ff87              228 = ffff87
121 = 87ffaf              229 = ffffaf
122 = 87ffd7              230 = ffffd7
123 = 87ffff              231 = ffffff

# Gray-scale range.
232 = 080808              244 = 808080
233 = 121212              245 = 8a8a8a
234 = 1c1c1c              246 = 949494
235 = 262626              247 = 9e9e9e
236 = 303030              248 = a8a8a8
237 = 3a3a3a              249 = b2b2b2
238 = 444444              250 = bcbcbc
239 = 4e4e4e              251 = c6c6c6
240 = 585858              252 = d0d0d0
241 = 626262              253 = dadada
242 = 6c6c6c              254 = e4e4e4
243 = 767676              255 = eeeeee
上一篇:【实用小站】配色网站


下一篇:Spring Cloud 系列之 Consul 配置中心