Tk Source Code

View Ticket
Login
2020-09-26
19:50 Add attachment macmenubarcolor.m to ticket [2a2dc34e08] artifact: 27cf09e8f3 user: bll
19:50 Add attachment tclmacmenubarcolor.m to ticket [2a2dc34e08] artifact: d3a8ea6daa user: bll
19:48 Ticket [2a2dc34e08] Mac OS: Question: Is there a way to get the color of the menu bar? status still Closed with 4 other changes artifact: 3f4c2de506 user: bll
19:28 Ticket [2a2dc34e08]: 4 changes artifact: 7aefbe62cb user: bll
19:26 Closed ticket [2a2dc34e08]. artifact: 42a7b1e0be user: bll
19:25 Add attachment macmenubarcolor.m to ticket [2a2dc34e08] artifact: 6358804d21 user: bll
17:17 Ticket [2a2dc34e08] Mac OS: Question: Is there a way to get the color of the menu bar? status still Open with 3 other changes artifact: 0e2f200175 user: bll
16:46 New ticket [2a2dc34e08]. artifact: 157685973a user: bll

Ticket UUID: 2a2dc34e084295d6f6ea5c134554d7329d0750ed
Title: Mac OS: Question: Is there a way to get the color of the menu bar?
Type: RFE Version: 8.6.10
Submitter: bll Created on: 2020-09-26 16:46:44
Subsystem: 66. Aqua Window Operations Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2020-09-26 19:48:46
Resolution: Works For Me Closed By: bll
    Closed on: 2020-09-26 19:48:46
Description:
Is there a way to retrieve the current color of the mac menu bar?

When I was researching mac colors, I didn't find a way, but that doesn't mean
there isn't one.

This is obviously minor, don't spend too much time on it.
User Comments: bll added on 2020-09-26 19:48:46:
bll-mac:/Volumes/Users/bll/Applications/BallroomDJ.app/Contents/MacOS/src$ rlwrap ../darwin/64/tcl/bin/tclsh
% load macmenubarcolor.dylib
% info commands macmenu*
macmenubarcolor
% macmenubarcolor
#2f181a
% time {macmenubarcolor} 200
33548.08365 microseconds per iteration
% puts [expr {33548.0 / 1000.0 / 1000.0}]
0.033548
%

bll added on 2020-09-26 19:28:31:
And yet:

bll-mac:/Volumes/Users/bll/Applications/BallroomDJ.app/Contents/MacOS/src$ time ./macmenubarcolor
#31191a

real    0m0.095s
user    0m0.026s
sys     0m0.012s

So it's a little expensive, but 0.1s isn't too bad.
Since it's not too bad, I will turn this into a package.

bll added on 2020-09-26 19:26:20:
See attached.

bll added on 2020-09-26 17:17:47:
This may be one way.  It's only good for a one-time capture, which would 
be fine for me.  I wouldn't want to run this every time the program starts.

It's in PyObjC, so I will have to somehow translate it to pure objective C
and make it work.

https://stackoverflow.com/questions/12978846/python-get-screen-pixel-value-in-os-x

Attachments: