Changeset 963
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Colors.cc
r943 r963 37 37 { 38 38 color_map_[ 0].label="green"; 39 color_map_[ 0]. r= 0; color_map_[ 0].g=146; color_map_[ 0].b= 72;39 color_map_[ 0].str="009248"; 40 40 color_map_[ 1].label="blue"; 41 color_map_[ 1]. r= 27; color_map_[ 1].g=117; color_map_[ 1].b=186;41 color_map_[ 1].str="1b75ba"; 42 42 color_map_[ 2].label="red"; 43 color_map_[ 2].r=189; color_map_[ 2].g= 32; color_map_[ 2].b= 46;43 color_map_[ 2].str="bd202e"; 44 44 color_map_[ 3].label="grey"; 45 color_map_[ 3]. r=131; color_map_[ 3].g=131; color_map_[ 3].b=131;45 color_map_[ 3].str="838383"; 46 46 color_map_[ 4].label="orange"; 47 color_map_[ 4]. r=245; color_map_[ 4].g=145; color_map_[ 4].b= 32;47 color_map_[ 4].str="f59120"; 48 48 color_map_[ 5].label="brown"; 49 color_map_[ 5]. r=117; color_map_[ 5].g= 77; color_map_[ 5].b= 41;49 color_map_[ 5].str="754d29"; 50 50 color_map_[ 6].label="cyan"; 51 color_map_[ 6]. r= 40; color_map_[ 6].g=170; color_map_[ 6].b=225;51 color_map_[ 6].str="28aae1"; 52 52 color_map_[ 7].label="lime"; 53 color_map_[ 7]. r=213; color_map_[ 7].g=221; color_map_[ 7].b= 38;53 color_map_[ 7].str="d5dd26"; 54 54 color_map_[ 8].label="purple"; 55 color_map_[ 8]. r=143; color_map_[ 8].g= 40; color_map_[ 8].b=140;55 color_map_[ 8].str="8f288c"; 56 56 color_map_[ 9].label="lgrey"; 57 color_map_[ 9]. r=220; color_map_[ 9].g=220; color_map_[ 9].b=220;57 color_map_[ 9].str="dcdcdc"; 58 58 color_map_[10].label="lbrown"; 59 color_map_[10]. r=194; color_map_[10].g=151; color_map_[10].b=106;59 color_map_[10].str="c2976a"; 60 60 color_map_[11].label="pink"; 61 color_map_[11]. r=230; color_map_[11].g=125; color_map_[11].b=230;61 color_map_[11].str="e67de6"; 62 62 color_map_[12].label="black"; 63 color_map_[12].r= 0; color_map_[12].g= 0; color_map_[12].b= 0; 63 color_map_[12].str="000000"; 64 // calculate corresponding rgb values 65 for (std::vector<color>::iterator col = color_map_.begin(); 66 col!=color_map_.end(); ++col) { 67 str2rgb(col->str, col->r, col->g, col->b); 68 } 64 69 65 70 typedef std::map<std::string, std::string> ACmap; … … 73 78 c.label=i->first; 74 79 str2rgb(i->second, c.r, c.g, c.b); 80 c.str = i->second; 75 81 next_color_=color_map_.insert(next_color_,c); 76 82 author_map_.insert(std::make_pair(c.label, next_color_++)); … … 79 85 80 86 81 void Colors::get_color(const std::string& label, unsigned char& r, 82 unsigned char& g, unsigned char& b) 87 const std::string& Colors::color_str(const std::string& label) 88 { 89 return get_color(label).str; 90 } 91 92 93 const Colors::color& Colors::get_color(const std::string& label) 83 94 { 84 95 std::map<std::string,std::vector<color>::iterator>::iterator i; … … 91 102 next_color_=color_map_.begin(); 92 103 } 93 r = i->second->r; 94 g = i->second->g; 95 b = i->second->b; 104 return *(i->second); 105 } 106 107 108 void Colors::get_color(const std::string& label, unsigned char& r, 109 unsigned char& g, unsigned char& b) 110 { 111 const color& col(get_color(label)); 112 r = col.r; 113 g = col.g; 114 b = col.b; 96 115 } 97 116 -
trunk/lib/Colors.h
r944 r963 43 43 44 44 /** 45 Same as get_color(4) but color is returned as a hexadecimal 46 string rather than in rgb. 47 48 \return color string associated with label 49 */ 50 const std::string& color_str(const std::string& label); 51 52 /** 45 53 \brief Get RGB color for \a label 46 54 … … 74 82 std::string label; 75 83 unsigned char r,g,b; 84 std::string str; 76 85 }; 86 87 const color& get_color(const std::string& label); 77 88 78 89 std::map<std::string, std::vector<color>::iterator> author_map_; -
trunk/lib/File.cc
r938 r963 23 23 24 24 #include "Alias.h" 25 #include "Colors.h" 25 26 #include "Configuration.h" 26 27 #include "Date.h" … … 290 291 hs << Date(blame.date())("%d %b %y"); 291 292 os << "</font></td>\n<td class=\"author\">"; 292 std::stringauthor_color =293 Co nfiguration::instance().author_str_color(blame.author());294 if (!author_color.empty())295 293 const std::string& author_color = 294 Colors::instance().color_str(blame.author()); 295 assert(!author_color.empty()); 296 os << "<font color=\"#" << author_color << "\">"; 296 297 hs << blame.author(); 297 298 os << "</td>\n<td class=\"";
Note: See TracChangeset
for help on using the changeset viewer.