Tkinter widget and/or system default colours

I’m trying to implement a tkinter widget that has similar (minimum) functionality to a Listbox, but allows for multi-lined entries.
Basically, it inherits from Frame, manages its own scrolling behavior, and each item is a Message within that frame.

To get a reasonable look&feel to it, when clicking on an item, I’d like it to highlight as the user would expect.

Is there a good way of using system/widget default colors for such tasks?
I found this page which suggests to me, that system colors are platform dependent. Is that correct? Or is there a way of referencing the “normal highlight color” OS independently?

Or should I manually implement colors for this, which might look good on the system I’m developing on, but will most likely look ugly or at least not organic on other systems?


The simplest solution is to create a temporary listbox and then ask tkinter to tell you what colors it is using.

listbox = tk.Listbox(root)
colors = {attr: listbox.cget(attr) for attr in (
    "background", "foreground", "disabledforeground",
    "highlightbackground", "highlightcolor",
    "selectbackground", "selectforeground"

The above will result in a dictionary of color options used by the listbox. On my OSX box it returns something like this:

    'background': 'systemTextBackgroundColor',
    'disabledforeground': '#a3a3a3',
    'foreground': 'systemTextColor',
    'highlightbackground': 'systemWindowBackgroundColor',
    'highlightcolor': 'Black',
    'selectbackground': 'systemSelectedTextBackgroundColor',
    'selectforeground': 'systemSelectedTextColor'