Colors and schemes - qPCR4vir/nana-docs GitHub Wiki
need creation! 🚧 select your color
class nana::color
📚.
The class color
provides some useful interfaces, from_rgb()
/from_hsl()
to assign a color
, and blend()
to mix 2 colors. Here also defines some helper types to initialize a color
.
using namespace nana;
//nana::colors defines some named color.
//Refer to http://www.w3.org/TR/2011/REC-css3-color-20110607/
//4.3. Extended color keywords for more details.
color col0{colors::silver};
//nana::color_rgb that an number represents a color.
color col1{static_cast<color_rgb>(0x112233)}; //red=0x11,green=0x22,blue=0x33
//nana::color_argb/nana::color_rgba that an number represents a color with alpha channel.
color col2{static_cast<color_argb>(0xff112233)}; //alpha=0xff,red=0x11,green=0x22,blue=0x33
color col3{static_cast<color_rgba>(0x112233ff)}; //red=0x11,green=0x22,blue=0x33,alpha=0xff
These helper types are 32-bit length, and useful to initialize a color
from a buffer of color data.
The color scheme is a system to customizing display of a widget. The library basically provides interfaces for changing a widget's background color and foreground color, but it is not enough for complex widget, such as listbox. By using color scheme, it is possible to change header color and item color for the listbox.
//nana::listbox lsbox;
lsbox.scheme().header_bgcolor = nana::colors::yellow;
lsbox.scheme().header_grabbed = nana::colors::chocolate;
nana::API::refresh_window(lsbox); //Apply the changes