Default text color for all widgets

41 views
Skip to first unread message

Webb Hinton

unread,
Jul 18, 2021, 4:30:18 PM7/18/21
to fltk.general
Seems like if we have methods for setting the global text size + global font, that there should also be a way to set the global text color?

When developing an app with a dark theme it can quickly become tedious to have to manually set the label color for each and every one of our widget classes.


Greg Ercolano

unread,
Jul 20, 2021, 1:23:52 PM7/20/21
to fltkg...@googlegroups.com


On 7/18/21 1:30 PM, Webb Hinton wrote:
Seems like if we have methods for setting the global text size + global font, that there should also be a way to set the global text color?

    I suppose if there were a 'global color', before calling the draw() of each widget,
    fltk could reset the current color to that value so that the color always starts at
    some default.


When developing an app with a dark theme it can quickly become tedious to have to manually set the label color for each and every one of our widget classes.

    Normally to do this you'd change the color map so that the new colors affect
    all widgets. See my replies in this thread from 2020. where I show how to make
    a dark theme this way. Please note there's two replies from me in that thread;
    the first describes the technique, the second shows some code showing how to
    redefine the color ramp commonly used for widget colors, and a file format
    allowing you to have different text files define different colormaps that can
    be loaded by the user while the app is running to choose different theme colors.

    Basically you get results like the below without having to customize widgets.

    Just make sure your widgets use predictable color map colors, preferably
    colors that are in the color ramp between colormap colors #32 and #56.


Reply all
Reply to author
Forward
0 new messages