{"id":24939,"date":"2019-04-09T14:37:59","date_gmt":"2019-04-09T18:37:59","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=24939"},"modified":"2019-04-10T14:22:23","modified_gmt":"2019-04-10T18:22:23","slug":"toggle-system-grayscale-mode","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/04\/09\/toggle-system-grayscale-mode\/","title":{"rendered":"Toggle System Grayscale Mode"},"content":{"rendered":"<p><a href=\"https:\/\/indiestack.com\/2019\/04\/toggle-system-grayscale-mode\/\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"https:\/\/indiestack.com\/2019\/04\/toggle-system-grayscale-mode\/\">\n<p>The framework name &ldquo;UniversalAccess&rdquo; correlates strongly with the &ldquo;UA&rdquo; prefix on the pertinent function names we dug up above. Great, so how do we call these? They&rsquo;re private system functions <em>which means you should not rely on them for production code<\/em>, but for a quick hack to make toggling grayscale easier? It&rsquo;s a reasonable risk in my opinion. Here&rsquo;s a <a href=\"https:\/\/gist.github.com\/danielpunkass\/df0d72be11b8956f2ef4f4d52cce7a41\">simple C program<\/a> that takes advantage of the private methods to simply toggle grayscale mode on or off, depending on the current setting.<\/p>\n<\/blockquote>\n<p>This is arguably more reliable than using GUI scripting, and definitely faster and less intrusive. Or, if you don&rsquo;t want use a compiler:<\/p>\n<blockquote cite=\"https:\/\/indiestack.com\/2019\/04\/toggle-system-grayscale-mode\/\">\n<p>This script takes advantage of Python&rsquo;s ability to dynamically load an arbitrary shared library and invoke its exported functions.<\/p>\n<\/blockquote>\n\n<p id=\"toggle-system-grayscale-mode-update-2019-04-10\">Update (2019-04-10): <a href=\"https:\/\/twitter.com\/marcoarment\/status\/1115793693406003201\">Marco Arment<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/marcoarment\/status\/1115793693406003201\">\n<p>I love this kind of power and customization, and it&rsquo;s the kind of thing we&rsquo;re losing with the dominance of iOS itself and the invasion of the iOS mindset into macOS<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Daniel Jalkut: The framework name &ldquo;UniversalAccess&rdquo; correlates strongly with the &ldquo;UA&rdquo; prefix on the pertinent function names we dug up above. Great, so how do we call these? They&rsquo;re private system functions which means you should not rely on them for production code, but for a quick hack to make toggling grayscale easier? It&rsquo;s a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-04-09T18:38:02Z","apple_news_api_id":"ad041abb-4c8d-4246-ab62-f955f0bf98a5","apple_news_api_modified_at":"2019-04-10T18:22:28Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/ArQQau0yNQkarYvlV8L-YpQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[930,45,30,1013,71,232,1181],"class_list":["post-24939","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-accessibility","tag-c","tag-mac","tag-private-api","tag-programming","tag-python","tag-system-preferences"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24939","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=24939"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24939\/revisions"}],"predecessor-version":[{"id":24946,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24939\/revisions\/24946"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=24939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=24939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=24939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}