printf ("\e[%dm%s\e[0m", (color) ? color->code : 30, str);
}
+void cprint24 (float red, float green, float blue, char *str)
+{
+ printf ("\e[48;2;%d;%d;%dm%s\e[0m", (int)(red * 255), (int)(green * 255), (int)(blue * 255), str);
+}
+
/* vim: set ts=4 sw=4 et: */
void cprint (color_t *color, char *str);
+void cprint24 (float red, float green, float blue, char *str);
+
#endif /* __COLOR_H__ */
/* vim: set ts=4 sw=4 et: */
for (l = 0; l < image->height; l++) {
for (k = 0; k < image->width; k++) {
int ind = k + image->width * l;
- color_t *color = findcolor (correction (image->red[ind], gf[0]), correction (image->green[ind], gf[1]), correction (image->blue[ind], gf[2]), colormap);
- cprint (color, (mode == 0) ? " " : " ");
+ if (colormap <= 2) {
+ color_t *color = findcolor (correction (image->red[ind], gf[0]), correction (image->green[ind], gf[1]), correction (image->blue[ind], gf[2]), colormap);
+ cprint (color, (mode == 0) ? " " : " ");
+ } else {
+ cprint24 (correction (image->red[ind], gf[0]), correction (image->green[ind], gf[1]), correction (image->blue[ind], gf[2]), (mode == 0) ? " " : " ");
+ }
}
printf ("\n");
}