const std::string WColor::cssText(bool withAlpha) const { if (default_) return std::string(); else { if (!name_.empty()) return name_.toUTF8(); else { WStringStream s; #ifndef WT_TARGET_JAVA char buf[30]; #else char *buf; #endif if (alpha_ != 255 && withAlpha) { s << "rgba(" << red_ << ',' << green_ << ',' << blue_ << ',' << Utils::round_css_str(alpha_ / 255., 2, buf) << ')'; } else s << "rgb(" << red_ << ',' << green_ << ',' << blue_ << ')'; return s.c_str(); } } }