diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 1998-10-06 18:21:25 +0000 |
| commit | f9039b2ae21988783feae9b362818e7923e82d14 (patch) | |
| tree | 6d6fe3679d73448758f9794e7d4d4f6b22a4adad /src/fl_set_gray.cxx | |
| parent | 67e89232f9ba067825a158734a09e0fa21aacbe3 (diff) | |
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_set_gray.cxx')
| -rw-r--r-- | src/fl_set_gray.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/fl_set_gray.cxx b/src/fl_set_gray.cxx new file mode 100644 index 000000000..c3b869f47 --- /dev/null +++ b/src/fl_set_gray.cxx @@ -0,0 +1,35 @@ +// fl_set_gray.C + +// -fg, -bg, and -bg2 switches + +#include <FL/Fl.H> + +void Fl::background(uchar r, uchar g, uchar b) { + // replace the gray ramp so that color 47 is this color + int i; + for (i = 32; i <= 47; i++) { + int m = (i-32)*255/23; + Fl::set_color(i,r*m/166,g*m/166,b*m/166); + } + for (; i < 56; i++) { + int m = 255-(i-32)*255/23; + Fl::set_color(i,255-(255-r)*m/89,255-(255-g)*m/89,255-(255-b)*m/89); + } +} + +static void set_others() { + uchar r,g,b; Fl::get_color(FL_BLACK,r,g,b); + uchar r1,g1,b1; Fl::get_color(FL_WHITE,r1,g1,b1); + Fl::set_color(FL_INACTIVE_COLOR,(2*r+r1)/3, (2*g+g1)/3, (2*b+b1)/3); + Fl::set_color(FL_SELECTION_COLOR,(2*r1+r)/3, (2*g1+g)/3, (2*b1+b)/3); +} + +void Fl::foreground(uchar r, uchar g, uchar b) { + Fl::set_color(FL_BLACK,r,g,b); + set_others(); +} + +void Fl::background2(uchar r, uchar g, uchar b) { + Fl::set_color(FL_WHITE,r,g,b); + set_others(); +} |
