diff options
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -2751,10 +2751,10 @@ int | |||
| 2751 | xsetcolorname(int x, const char *name) { | 2751 | xsetcolorname(int x, const char *name) { |
| 2752 | XRenderColor color = { .alpha = 0xffff }; | 2752 | XRenderColor color = { .alpha = 0xffff }; |
| 2753 | Colour colour; | 2753 | Colour colour; |
| 2754 | if (x < 0 || x > LEN(colorname)) | 2754 | if(!BETWEEN(x, 0, LEN(colorname))) |
| 2755 | return -1; | 2755 | return -1; |
| 2756 | if(!name) { | 2756 | if(!name) { |
| 2757 | if(16 <= x && x < 16 + 216) { | 2757 | if(BETWEEN(x, 16, 16 + 215)) { |
| 2758 | int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6; | 2758 | int r = (x - 16) / 36, g = ((x - 16) % 36) / 6, b = (x - 16) % 6; |
| 2759 | color.red = sixd_to_16bit(r); | 2759 | color.red = sixd_to_16bit(r); |
| 2760 | color.green = sixd_to_16bit(g); | 2760 | color.green = sixd_to_16bit(g); |
| @@ -2763,7 +2763,7 @@ xsetcolorname(int x, const char *name) { | |||
| 2763 | return 0; /* something went wrong */ | 2763 | return 0; /* something went wrong */ |
| 2764 | dc.col[x] = colour; | 2764 | dc.col[x] = colour; |
| 2765 | return 1; | 2765 | return 1; |
| 2766 | } else if (16 + 216 <= x && x < 256) { | 2766 | } else if(BETWEEN(x, 16 + 216, 255)) { |
| 2767 | color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216)); | 2767 | color.red = color.green = color.blue = 0x0808 + 0x0a0a * (x - (16 + 216)); |
| 2768 | if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour)) | 2768 | if(!XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, &colour)) |
| 2769 | return 0; /* something went wrong */ | 2769 | return 0; /* something went wrong */ |
