FLTK logo

Re: [fltk.general] Fl_Color sequence

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Color sequence Ian MacArthur Dec 21, 2015  
 
On Mon Dec 21 2015 02:44:25, Rob McDonald wrote:
> Is there a way in FLTK to get a sequence of Fl_Colors that are visually distinct?


Woah! Can. Of. Worms...

“Visually distinct” is the kicker here; folks have earned their PhD writing papers on what that constitutes...

There’s no fltk way of doing that, per se; indeed I’d say there’s no agreed way of doing that at all (though the W3C do have a pile of handy guidelines...)

If you just want to get “different” colours, and are not too bothered what they are, or that they maintain a constant contrast or visual separation from the other colours you are using, then you might get adequate results just doing:-

  int idx;
  for (idx = 60; idx < 255; ++idx)
  {
    Fl_Color X = idx;
    fl_color(X):
    ...etc...
  }

(where X is the index you want, based on the fltk colour cube or whatever)

That should give you different colours, but I can’t promise they will be "visually distinct".


For a more complex solution, I’d pick <whichever of the many possible algorithms you believe in> and use that to generate a set of suitably spaced RGB triplets and pass them via fl_color(R,G,B); to set the colour that way.



> 
> I'm making a technical plot with few to perhaps many lines on it.  I'll do a for-loop over the lines as I add them to my drawing canvas.  I'd like them to display with unique colors -- I'll know how many lines there will be before I start.
> 
> Is there a built-in way to do this in FLTK?
> 
> Thanks for any suggestions,


Even the unhelpful ones? (Like mine.)



-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.