FLTK custom themes

86 views
Skip to first unread message

DarkGren

unread,
Oct 4, 2020, 11:32:49 PM10/4/20
to fltk.general
The default theme looks uh.. a bit ugly imo, is there a way to customise FLTK with themes?

Greg Ercolano

unread,
Oct 5, 2020, 2:42:44 AM10/5/20
to fltkg...@googlegroups.com
On 2020-10-04 20:31, DarkGren wrote:
> The default theme looks uh.. a bit ugly imo
> is there a way to customise FLTK with themes?

Try putting /one/ of these settings at the top of main(), to try the different 'themes'
that FLTK comes with:

Fl::scheme("gtk+");
Fl::scheme("gleam");

Both improve the interfaces quite a bit.
(There is also a "plastic" scheme, but it's kinda old looking)

You can also run the demo programs with different command line options to change the scheme
to see how the different widgets look, e.g.

cd test
./buttons -- default scheme
./buttons -scheme gtk+ -- use gtk+ scheme
./buttons -scheme gleam -- use gleam scheme

If you don't like either of those, you can change the color map for the gray ramp
to tint the interface different colors, but you're kinda on your own with that.

To implement a new scheme is kinda tricky, as there's no API provided to change
the scheme; you basically have to hack into the code to make more extensive changes.

That said, people have gone a long way making nice looking interfaces in FLTK using
combos of changing the color maps and/or using the above scheme options.

Greg Ercolano

unread,
Oct 5, 2020, 2:59:28 AM10/5/20
to fltkg...@googlegroups.com
On 2020-10-04 23:42, Greg Ercolano wrote:
> That said, people have gone a long way making nice looking interfaces in FLTK using
> combos of changing the color maps and/or using the above scheme options.

BTW, here are a few example FLTK app screenshots people have made:

http://non.tuxfamily.org/non-stuff-huge.png
https://non.tuxfamily.org/e-517eedad832f11.95473617.png
https://non.tuxfamily.org/wiki/Screenshots

http://prodatum.sourceforge.net/screenshots/current.png
http://prodatum.sourceforge.net/screenshots/v2.0/rc14.png
http://prodatum.sourceforge.net/screenshots/v0.99/keyboard.png

http://www.seriss.com/rush.103.00/features/gifs/irush-black-theme.jpg
http://www.seriss.com/rush.103.00/features/gifs/input-black-theme.jpg
http://www.seriss.com/rush.103.00/features/gifs/rushtop-103.05-font-adjust.png

Also, the inclusion of nanosvg inside FLTK has opened up things quite a bit
so that people can make custom widgets using SVG's nicer drawing. Not sure if
anyone's really pushed on that, but it has great potential.

For example, I made this realtime altimeter simulation in FLTK relatively easily
using SVG rendering to get nice antialiased results with shadows and compositing:
http://seriss.com/people/erco/fltk/#Altimeter

Another example is this simplex analog clock:
http://seriss.com/people/erco/fltk/#FLTK-Simplex-Clock

w1hkj

unread,
Oct 5, 2020, 5:23:26 PM10/5/20
to fltkg...@googlegroups.com

Greg,

Thank you for sharing  your very illuminating examples.

Dave

Greg Ercolano

unread,
Oct 5, 2020, 7:59:40 PM10/5/20
to fltkg...@googlegroups.com
Small correction on the above; the altimeter app doesn't use SVG,
it uses multiple external PNG files with alpha channels.

Only the Simplex clock example uses SVG, with the SVG file's text
embedded within the C++ code, using sprintf() to change the rotation angle
of the various elements, and avoiding the need to refer to external files.
Reply all
Reply to author
Forward
0 new messages