Define the complete named xterm color palette
This commit is contained in:
parent
465648e448
commit
4ca0d31b7d
3 changed files with 261 additions and 14 deletions
271
murx.c
271
murx.c
|
|
@ -102,16 +102,263 @@ typedef struct {
|
|||
|
||||
static int send_msg(int fd, uint32_t type, const void *data, size_t len);
|
||||
|
||||
/* colour palette */
|
||||
#define C_BLACK 0
|
||||
#define C_CYAN 6
|
||||
#define C_WHITE 7
|
||||
#define C_GREY 8
|
||||
#define C_RED 9
|
||||
#define C_YELLOW 11
|
||||
#define C_BLUE 12
|
||||
#define C_CYAN2 14
|
||||
#define C_BWHITE 15
|
||||
/* xterm-256 palette indices. The terminal defines the ANSI colours. */
|
||||
#define C_BLACK 0
|
||||
#define C_MAROON 1
|
||||
#define C_DGREEN 2
|
||||
#define C_OLIVE 3
|
||||
#define C_NAVY 4
|
||||
#define C_PURPLE 5
|
||||
#define C_CYAN 6
|
||||
#define C_WHITE 7
|
||||
#define C_GREY 8
|
||||
#define C_RED 9
|
||||
#define C_GREEN 10
|
||||
#define C_YELLOW 11
|
||||
#define C_BLUE 12
|
||||
#define C_MAGENTA 13
|
||||
#define C_CYAN2 14
|
||||
#define C_BWHITE 15
|
||||
#define C_GREY_0 16
|
||||
#define C_NAVY_BLUE 17
|
||||
#define C_DARK_BLUE 18
|
||||
#define C_BLUE_3_19 19
|
||||
#define C_BLUE_3_20 20
|
||||
#define C_BLUE_1 21
|
||||
#define C_DARK_GREEN 22
|
||||
#define C_DEEP_SKY_BLUE_4_23 23
|
||||
#define C_DEEP_SKY_BLUE_4_24 24
|
||||
#define C_DEEP_SKY_BLUE_4_25 25
|
||||
#define C_DODGER_BLUE_3 26
|
||||
#define C_DODGER_BLUE_2 27
|
||||
#define C_GREEN_4 28
|
||||
#define C_SPRING_GREEN_4 29
|
||||
#define C_TURQUOISE_4 30
|
||||
#define C_DEEP_SKY_BLUE_3_31 31
|
||||
#define C_DEEP_SKY_BLUE_3_32 32
|
||||
#define C_DODGER_BLUE_1 33
|
||||
#define C_GREEN_3_34 34
|
||||
#define C_SPRING_GREEN_3_35 35
|
||||
#define C_DARK_CYAN 36
|
||||
#define C_LIGHT_SEA_GREEN 37
|
||||
#define C_DEEP_SKY_BLUE_2 38
|
||||
#define C_DEEP_SKY_BLUE_1 39
|
||||
#define C_GREEN_3_40 40
|
||||
#define C_SPRING_GREEN_3_41 41
|
||||
#define C_SPRING_GREEN_2_42 42
|
||||
#define C_CYAN_3 43
|
||||
#define C_DARK_TURQUOISE 44
|
||||
#define C_TURQUOISE_2 45
|
||||
#define C_GREEN_1 46
|
||||
#define C_SPRING_GREEN_2_47 47
|
||||
#define C_SPRING_GREEN_1 48
|
||||
#define C_MEDIUM_SPRING_GREEN 49
|
||||
#define C_CYAN_2 50
|
||||
#define C_CYAN_1 51
|
||||
#define C_DARK_RED_52 52
|
||||
#define C_DEEP_PINK_4_53 53
|
||||
#define C_PURPLE_4_54 54
|
||||
#define C_PURPLE_4_55 55
|
||||
#define C_PURPLE_3 56
|
||||
#define C_BLUE_VIOLET 57
|
||||
#define C_ORANGE_4_58 58
|
||||
#define C_GREY_37 59
|
||||
#define C_MEDIUM_PURPLE_4 60
|
||||
#define C_SLATE_BLUE_3_61 61
|
||||
#define C_SLATE_BLUE_3_62 62
|
||||
#define C_ROYAL_BLUE_1 63
|
||||
#define C_CHARTREUSE_4 64
|
||||
#define C_DARK_SEA_GREEN_4_65 65
|
||||
#define C_PALE_TURQUOISE_4 66
|
||||
#define C_STEEL_BLUE 67
|
||||
#define C_STEEL_BLUE_3 68
|
||||
#define C_CORNFLOWER_BLUE 69
|
||||
#define C_CHARTREUSE_3_70 70
|
||||
#define C_DARK_SEA_GREEN_4_71 71
|
||||
#define C_CADET_BLUE_72 72
|
||||
#define C_CADET_BLUE_73 73
|
||||
#define C_SKY_BLUE_3 74
|
||||
#define C_STEEL_BLUE_1_75 75
|
||||
#define C_CHARTREUSE_3_76 76
|
||||
#define C_PALE_GREEN_3_77 77
|
||||
#define C_SEA_GREEN_3 78
|
||||
#define C_AQUAMARINE_3 79
|
||||
#define C_MEDIUM_TURQUOISE 80
|
||||
#define C_STEEL_BLUE_1_81 81
|
||||
#define C_CHARTREUSE_2_82 82
|
||||
#define C_SEA_GREEN_2 83
|
||||
#define C_SEA_GREEN_1_84 84
|
||||
#define C_SEA_GREEN_1_85 85
|
||||
#define C_AQUAMARINE_1_86 86
|
||||
#define C_DARK_SLATE_GRAY_2 87
|
||||
#define C_DARK_RED_88 88
|
||||
#define C_DEEP_PINK_4_89 89
|
||||
#define C_DARK_MAGENTA_90 90
|
||||
#define C_DARK_MAGENTA_91 91
|
||||
#define C_DARK_VIOLET_92 92
|
||||
#define C_PURPLE_93 93
|
||||
#define C_ORANGE_4_94 94
|
||||
#define C_LIGHT_PINK_4 95
|
||||
#define C_PLUM_4 96
|
||||
#define C_MEDIUM_PURPLE_3_97 97
|
||||
#define C_MEDIUM_PURPLE_3_98 98
|
||||
#define C_SLATE_BLUE_1 99
|
||||
#define C_YELLOW_4_100 100
|
||||
#define C_WHEAT_4 101
|
||||
#define C_GREY_53 102
|
||||
#define C_LIGHT_SLATE_GREY 103
|
||||
#define C_MEDIUM_PURPLE 104
|
||||
#define C_LIGHT_SLATE_BLUE 105
|
||||
#define C_YELLOW_4_106 106
|
||||
#define C_DARK_OLIVE_GREEN_3_107 107
|
||||
#define C_DARK_SEA_GREEN 108
|
||||
#define C_LIGHT_SKY_BLUE_3_109 109
|
||||
#define C_LIGHT_SKY_BLUE_3_110 110
|
||||
#define C_SKY_BLUE_2 111
|
||||
#define C_CHARTREUSE_2_112 112
|
||||
#define C_DARK_OLIVE_GREEN_3_113 113
|
||||
#define C_PALE_GREEN_3_114 114
|
||||
#define C_DARK_SEA_GREEN_3_115 115
|
||||
#define C_DARK_SLATE_GRAY_3 116
|
||||
#define C_SKY_BLUE_1 117
|
||||
#define C_CHARTREUSE_1 118
|
||||
#define C_LIGHT_GREEN_119 119
|
||||
#define C_LIGHT_GREEN_120 120
|
||||
#define C_PALE_GREEN_1_121 121
|
||||
#define C_AQUAMARINE_1_122 122
|
||||
#define C_DARK_SLATE_GRAY_1 123
|
||||
#define C_RED_3_124 124
|
||||
#define C_DEEP_PINK_4_125 125
|
||||
#define C_MEDIUM_VIOLET_RED 126
|
||||
#define C_MAGENTA_3_127 127
|
||||
#define C_DARK_VIOLET_128 128
|
||||
#define C_PURPLE_129 129
|
||||
#define C_DARK_ORANGE_3_130 130
|
||||
#define C_INDIAN_RED_131 131
|
||||
#define C_HOT_PINK_3_132 132
|
||||
#define C_MEDIUM_ORCHID_3 133
|
||||
#define C_MEDIUM_ORCHID 134
|
||||
#define C_MEDIUM_PURPLE_2_135 135
|
||||
#define C_DARK_GOLDENROD 136
|
||||
#define C_LIGHT_SALMON_3_137 137
|
||||
#define C_ROSY_BROWN 138
|
||||
#define C_GREY_63 139
|
||||
#define C_MEDIUM_PURPLE_2_140 140
|
||||
#define C_MEDIUM_PURPLE_1 141
|
||||
#define C_GOLD_3_142 142
|
||||
#define C_DARK_KHAKI 143
|
||||
#define C_NAVAJO_WHITE_3 144
|
||||
#define C_GREY_69 145
|
||||
#define C_LIGHT_STEEL_BLUE_3 146
|
||||
#define C_LIGHT_STEEL_BLUE 147
|
||||
#define C_YELLOW_3_148 148
|
||||
#define C_DARK_OLIVE_GREEN_3_149 149
|
||||
#define C_DARK_SEA_GREEN_3_150 150
|
||||
#define C_DARK_SEA_GREEN_2_151 151
|
||||
#define C_LIGHT_CYAN_3 152
|
||||
#define C_LIGHT_SKY_BLUE_1 153
|
||||
#define C_GREEN_YELLOW 154
|
||||
#define C_DARK_OLIVE_GREEN_2 155
|
||||
#define C_PALE_GREEN_1_156 156
|
||||
#define C_DARK_SEA_GREEN_2_157 157
|
||||
#define C_DARK_SEA_GREEN_1_158 158
|
||||
#define C_PALE_TURQUOISE_1 159
|
||||
#define C_RED_3_160 160
|
||||
#define C_DEEP_PINK_3_161 161
|
||||
#define C_DEEP_PINK_3_162 162
|
||||
#define C_MAGENTA_3_163 163
|
||||
#define C_MAGENTA_3_164 164
|
||||
#define C_MAGENTA_2_165 165
|
||||
#define C_DARK_ORANGE_3_166 166
|
||||
#define C_INDIAN_RED_167 167
|
||||
#define C_HOT_PINK_3_168 168
|
||||
#define C_HOT_PINK_2 169
|
||||
#define C_ORCHID 170
|
||||
#define C_MEDIUM_ORCHID_1_171 171
|
||||
#define C_ORANGE_3 172
|
||||
#define C_LIGHT_SALMON_3_173 173
|
||||
#define C_LIGHT_PINK_3 174
|
||||
#define C_PINK_3 175
|
||||
#define C_PLUM_3 176
|
||||
#define C_VIOLET 177
|
||||
#define C_GOLD_3_178 178
|
||||
#define C_LIGHT_GOLDENROD_3 179
|
||||
#define C_TAN 180
|
||||
#define C_MISTY_ROSE_3 181
|
||||
#define C_THISTLE_3 182
|
||||
#define C_PLUM_2 183
|
||||
#define C_YELLOW_3_184 184
|
||||
#define C_KHAKI_3 185
|
||||
#define C_LIGHT_GOLDENROD_2_186 186
|
||||
#define C_LIGHT_YELLOW_3 187
|
||||
#define C_GREY_84 188
|
||||
#define C_LIGHT_STEEL_BLUE_1 189
|
||||
#define C_YELLOW_2 190
|
||||
#define C_DARK_OLIVE_GREEN_1_191 191
|
||||
#define C_DARK_OLIVE_GREEN_1_192 192
|
||||
#define C_DARK_SEA_GREEN_1_193 193
|
||||
#define C_HONEYDEW_2 194
|
||||
#define C_LIGHT_CYAN_1 195
|
||||
#define C_RED_1 196
|
||||
#define C_DEEP_PINK_2 197
|
||||
#define C_DEEP_PINK_1_198 198
|
||||
#define C_DEEP_PINK_1_199 199
|
||||
#define C_MAGENTA_2_200 200
|
||||
#define C_MAGENTA_1 201
|
||||
#define C_ORANGE_RED_1 202
|
||||
#define C_INDIAN_RED_1_203 203
|
||||
#define C_INDIAN_RED_1_204 204
|
||||
#define C_HOT_PINK_205 205
|
||||
#define C_HOT_PINK_206 206
|
||||
#define C_MEDIUM_ORCHID_1_207 207
|
||||
#define C_DARK_ORANGE 208
|
||||
#define C_SALMON_1 209
|
||||
#define C_LIGHT_CORAL 210
|
||||
#define C_PALE_VIOLET_RED_1 211
|
||||
#define C_ORCHID_2 212
|
||||
#define C_ORCHID_1 213
|
||||
#define C_ORANGE_1 214
|
||||
#define C_SANDY_BROWN 215
|
||||
#define C_LIGHT_SALMON_1 216
|
||||
#define C_LIGHT_PINK_1 217
|
||||
#define C_PINK_1 218
|
||||
#define C_PLUM_1 219
|
||||
#define C_GOLD_1 220
|
||||
#define C_LIGHT_GOLDENROD_2_221 221
|
||||
#define C_LIGHT_GOLDENROD_2_222 222
|
||||
#define C_NAVAJO_WHITE_1 223
|
||||
#define C_MISTY_ROSE_1 224
|
||||
#define C_THISTLE_1 225
|
||||
#define C_YELLOW_1 226
|
||||
#define C_LIGHT_GOLDENROD_1 227
|
||||
#define C_KHAKI_1 228
|
||||
#define C_WHEAT_1 229
|
||||
#define C_CORNSILK_1 230
|
||||
#define C_GREY_100 231
|
||||
#define C_GREY_3 232
|
||||
#define C_GREY_7 233
|
||||
#define C_GREY_11 234
|
||||
#define C_GREY_15 235
|
||||
#define C_GREY_19 236
|
||||
#define C_GREY_23 237
|
||||
#define C_GREY_27 238
|
||||
#define C_GREY_30 239
|
||||
#define C_GREY_35 240
|
||||
#define C_GREY_39 241
|
||||
#define C_GREY_42 242
|
||||
#define C_GREY_46 243
|
||||
#define C_GREY_50 244
|
||||
#define C_GREY_54 245
|
||||
#define C_GREY_58 246
|
||||
#define C_GREY_62 247
|
||||
#define C_GREY_66 248
|
||||
#define C_GREY_70 249
|
||||
#define C_GREY_74 250
|
||||
#define C_GREY_78 251
|
||||
#define C_GREY_82 252
|
||||
#define C_GREY_85 253
|
||||
#define C_GREY_89 254
|
||||
#define C_GREY_93 255
|
||||
|
||||
/* Pane borders: thin box-drawing lines in a muted grey, drawn over the
|
||||
terminal's own background. */
|
||||
|
|
@ -2748,7 +2995,7 @@ static int color256_from_rgb(int r, int g, int b) {
|
|||
int cr = nearest_cube_level(r, &ri);
|
||||
int cg = nearest_cube_level(g, &gi);
|
||||
int cb = nearest_cube_level(b, &bi);
|
||||
int cube = 16 + 36 * ri + 6 * gi + bi;
|
||||
int cube = C_GREY_0 + 36 * ri + 6 * gi + bi;
|
||||
long cubed = (long)(r - cr) * (r - cr) +
|
||||
(long)(g - cg) * (g - cg) +
|
||||
(long)(b - cb) * (b - cb);
|
||||
|
|
@ -2762,7 +3009,7 @@ static int color256_from_rgb(int r, int g, int b) {
|
|||
(long)(g - gv) * (g - gv) +
|
||||
(long)(b - gv) * (b - gv);
|
||||
|
||||
if (grayd < cubed) return 232 + gidx;
|
||||
if (grayd < cubed) return C_GREY_3 + gidx;
|
||||
return cube;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ package() {
|
|||
}
|
||||
|
||||
sha512sums="
|
||||
f861459121c3beec590a4d9a40f1a66ebc7933c024cca0c9c18a1608ca11e5ad1b064e0f732bafa0c153e57b45faa10c623387fc162c43aab81bd7607435fd6f murx.c
|
||||
299f4fcc053bcf46313ad34655aaf9180b59dc3a86758fd24e848c0cb1933d99ceeb56e4f85c592dd612d625f55b118284ee6a94c991216af61daa343091d518 murx.c
|
||||
ac75bfe596fae665ba882a10f5d16551bdd02cd601b786364763ac74dbc651c386d3a464eb63e0344354b953611629135190633e3b8ff3a8ef0f0849d60a3f7b Makefile
|
||||
7546e0d84cb9094b4b2ac14e05d38a37270c2a4451f3d41aaa7b0b38290acb0ff6de821331634c802d08568817cf1ed0fbb5afd6734ef4a8155720b826ab6ce9 murx.1
|
||||
162b917a63a481554368083ba4d285c759c4c62148b073d658a8e32840f1aeffedff369876190cc0d2f164efdb800220bee882d823fa350b2063d022842e1182 MURX-README.md
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ url='https://codeberg.org/armin/murx'
|
|||
license=('Apache-2.0')
|
||||
depends=('glibc')
|
||||
source=('murx.c' 'Makefile' 'murx.1' 'MURX-README.md' 'LICENSE' 'AUTHORS')
|
||||
sha256sums=('936dc8c7fb6d1538f8a1d8f9110eeb8bc0a627ca4847f8edffb7a9afcf4f7c53'
|
||||
sha256sums=('4ab7d155c3d9b23c22fc5792837ce2dd4e020cf0998edb743e7726edee73b438'
|
||||
'78a9c19c212e8038422e1bb4bb96d9b25eb19ad1359489cd32edf9e1a76638b2'
|
||||
'a4b48ce1c847869956ea52eac50c51446a9e6f720d8e4b211cb97a78a7f53663'
|
||||
'd86bb6257dee64ff4709faf4ab8c1dc2d6adfc98b464978389bcfa88568e63fb'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue