1 /** 2 * \file z-color.h 3 * \brief Generic color definitions 4 * 5 * Copyright (c) 1997 Ben Harrison 6 * 7 * This software may be copied and distributed for educational, research, 8 * and not for profit purposes provided that this copyright and statement 9 * are included in all such copies. 10 */ 11 12 #ifndef INCLUDED_Z_COLOR_H 13 #define INCLUDED_Z_COLOR_H 14 15 #include "h-basic.h" 16 17 /** 18 * Angband "attributes" (with symbols, and base (R,G,B) codes) 19 * 20 * The "(R,G,B)" codes are given in "fourths" of the "maximal" value, 21 * and should "gamma corrected" on most (non-Macintosh) machines. 22 */ 23 #define COLOUR_DARK 0 /* d */ /* 0 0 0 */ 24 #define COLOUR_WHITE 1 /* w */ /* 4 4 4 */ 25 #define COLOUR_SLATE 2 /* s */ /* 2 2 2 */ 26 #define COLOUR_ORANGE 3 /* o */ /* 4 2 0 */ 27 #define COLOUR_RED 4 /* r */ /* 3 0 0 */ 28 #define COLOUR_GREEN 5 /* g */ /* 0 2 1 */ 29 #define COLOUR_BLUE 6 /* b */ /* 0 0 4 */ 30 #define COLOUR_UMBER 7 /* u */ /* 2 1 0 */ 31 #define COLOUR_L_DARK 8 /* D */ /* 1 1 1 */ 32 #define COLOUR_L_WHITE 9 /* W */ /* 3 3 3 */ 33 #define COLOUR_L_PURPLE 10 /* P */ /* ? ? ? */ 34 #define COLOUR_YELLOW 11 /* y */ /* 4 4 0 */ 35 #define COLOUR_L_RED 12 /* R */ /* 4 0 0 */ 36 #define COLOUR_L_GREEN 13 /* G */ /* 0 4 0 */ 37 #define COLOUR_L_BLUE 14 /* B */ /* 0 4 4 */ 38 #define COLOUR_L_UMBER 15 /* U */ /* 3 2 1 */ 39 40 #define COLOUR_PURPLE 16 /* p */ 41 #define COLOUR_VIOLET 17 /* v */ 42 #define COLOUR_TEAL 18 /* t */ 43 #define COLOUR_MUD 19 /* m */ 44 #define COLOUR_L_YELLOW 20 /* Y */ 45 #define COLOUR_MAGENTA 21 /* i */ 46 #define COLOUR_L_TEAL 22 /* T */ 47 #define COLOUR_L_VIOLET 23 /* V */ 48 #define COLOUR_L_PINK 24 /* I */ 49 #define COLOUR_MUSTARD 25 /* M */ 50 #define COLOUR_BLUE_SLATE 26 /* z */ 51 #define COLOUR_DEEP_L_BLUE 27 /* Z */ 52 #define COLOUR_SHADE 28 /* for shaded backgrounds */ 53 54 /** 55 * The following allow color 'translations' to support environments with a 56 * limited color depth as well as translate colours to alternates 57 * for e.g. menu highlighting. 58 */ 59 #define ATTR_FULL 0 /* full color translation */ 60 #define ATTR_MONO 1 /* mono color translation */ 61 #define ATTR_VGA 2 /* 16 color translation */ 62 #define ATTR_BLIND 3 /* "Blind" color translation */ 63 #define ATTR_LIGHT 4 /* "Torchlit" color translation */ 64 #define ATTR_DARK 5 /* "Dark" color translation */ 65 #define ATTR_HIGH 6 /* "Highlight" color translation */ 66 #define ATTR_METAL 7 /* "Metallic" color translation */ 67 #define ATTR_MISC 8 /* "Miscellaneous" - see misc_to_attr */ 68 69 #define MAX_ATTR 9 70 71 /** 72 * Maximum number of colours, and number of "basic" Angband colours 73 */ 74 #define MAX_COLORS 256 75 #define BASIC_COLORS 29 76 #define BG_BLACK 0 /* The set number for the black-background glyphs */ 77 #define BG_SAME 1 /* The set number for the same-background glyphs */ 78 #define BG_DARK 2 /* The set number for the dark-background glyphs */ 79 #define BG_MAX 3 /* The max number of backgrounds */ 80 81 /** 82 * A game color. 83 */ 84 typedef struct color_type color_type; 85 struct color_type 86 { 87 char index_char; /* Character index: 'r' = red, etc. */ 88 char name[32]; /* Color name */ 89 byte color_translate[MAX_ATTR]; /* Index for various in-game translations */ 90 }; 91 92 extern byte angband_color_table[MAX_COLORS][4]; 93 extern color_type color_table[MAX_COLORS]; 94 95 extern int color_char_to_attr(char c); 96 extern int color_text_to_attr(const char *name); 97 extern const char *attr_to_text(byte a); 98 extern byte get_color(byte a, int attr, int n); 99 100 extern void build_gamma_table(int gamma); 101 extern byte gamma_table[256]; 102 103 #endif /* INCLUDED_Z_COLOR_H */ 104 105