… | |
… | |
3332 | { |
3332 | { |
3333 | process_xterm_seq (arg, s, eh); |
3333 | process_xterm_seq (arg, s, eh); |
3334 | free (s); |
3334 | free (s); |
3335 | } |
3335 | } |
3336 | } |
3336 | } |
|
|
3337 | } |
|
|
3338 | |
|
|
3339 | /* |
|
|
3340 | * Find the nearest color slot in the hidden color cube, |
|
|
3341 | * adapt its value to the 24bit RGB color. |
|
|
3342 | */ |
|
|
3343 | unsigned int |
|
|
3344 | rxvt_term::map_rgb24_color (unsigned int r, unsigned int g, unsigned int b) |
|
|
3345 | { |
|
|
3346 | unsigned int idx_r = (r & 0xff) / (0xff / (Red_levels - 1)); |
|
|
3347 | unsigned int idx_g = (g & 0xff) / (0xff / (Green_levels - 1)); |
|
|
3348 | unsigned int idx_b = (b & 0xff) / (0xff / (Blue_levels - 1)); |
|
|
3349 | unsigned int idx; |
|
|
3350 | |
|
|
3351 | idx = minTermCOLOR24 + idx_r * Blue_levels * Green_levels + |
|
|
3352 | idx_g * Blue_levels + |
|
|
3353 | idx_b; |
|
|
3354 | |
|
|
3355 | pix_colors_focused [idx].free (this); |
|
|
3356 | pix_colors_focused [idx].set (this, rgba (r * 0x0101, |
|
|
3357 | g * 0x0101, |
|
|
3358 | b * 0x0101)); |
|
|
3359 | update_fade_color (idx, false); |
|
|
3360 | |
|
|
3361 | return idx; |
3337 | } |
3362 | } |
3338 | |
3363 | |
3339 | void |
3364 | void |
3340 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3365 | rxvt_term::process_color_seq (int report, int color, const char *str, char resp) |
3341 | { |
3366 | { |
… | |
… | |
3976 | if (nargs > i + 2 && arg[i + 1] == 5) |
4001 | if (nargs > i + 2 && arg[i + 1] == 5) |
3977 | { |
4002 | { |
3978 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
4003 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg); |
3979 | i += 2; |
4004 | i += 2; |
3980 | } |
4005 | } |
|
|
4006 | else if (nargs > i + 4 && arg[i + 1] == 2) |
|
|
4007 | { |
|
|
4008 | unsigned int r = arg[i + 2]; |
|
|
4009 | unsigned int g = arg[i + 3]; |
|
|
4010 | unsigned int b = arg[i + 4]; |
|
|
4011 | unsigned int idx = map_rgb24_color (r, g, b); |
|
|
4012 | scr_color (idx, Color_fg); |
|
|
4013 | i += 4; |
|
|
4014 | } |
3981 | break; |
4015 | break; |
3982 | case 39: /* default fg */ |
4016 | case 39: /* default fg */ |
3983 | scr_color (Color_fg, Color_fg); |
4017 | scr_color (Color_fg, Color_fg); |
3984 | break; |
4018 | break; |
3985 | |
4019 | |
… | |
… | |
3996 | case 48: // set bg color, ISO 8613-6 |
4030 | case 48: // set bg color, ISO 8613-6 |
3997 | if (nargs > i + 2 && arg[i + 1] == 5) |
4031 | if (nargs > i + 2 && arg[i + 1] == 5) |
3998 | { |
4032 | { |
3999 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4033 | scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg); |
4000 | i += 2; |
4034 | i += 2; |
|
|
4035 | } |
|
|
4036 | else if (nargs > i + 4 && arg[i + 1] == 2) |
|
|
4037 | { |
|
|
4038 | unsigned int r = arg[i + 2]; |
|
|
4039 | unsigned int g = arg[i + 3]; |
|
|
4040 | unsigned int b = arg[i + 4]; |
|
|
4041 | unsigned int idx = map_rgb24_color (r, g, b); |
|
|
4042 | scr_color (idx, Color_bg); |
|
|
4043 | i += 4; |
4001 | } |
4044 | } |
4002 | break; |
4045 | break; |
4003 | case 49: /* default bg */ |
4046 | case 49: /* default bg */ |
4004 | scr_color (Color_bg, Color_bg); |
4047 | scr_color (Color_bg, Color_bg); |
4005 | break; |
4048 | break; |