Skip to content

Instantly share code, notes, and snippets.

@saagarjha
Last active February 8, 2021 23:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saagarjha/d43316472096b7eed22f55ad20f6dd0e to your computer and use it in GitHub Desktop.
Save saagarjha/d43316472096b7eed22f55ad20f6dd0e to your computer and use it in GitHub Desktop.
Set the correct iTerm profile based on whether dark mode is enabled or not
// Compile with clang -F/System/Library/PrivateFrameworks -framework SkyLight iterm-set-profile.m
#import <Foundation/Foundation.h>
BOOL SLSGetAppearanceThemeLegacy(void);
int main() {
if (SLSGetAppearanceThemeLegacy()) {
printf("\033]50;SetProfile=Solarized Dark\a");
} else {
printf("\033]50;SetProfile=Solarized Light\a");
}
fflush(stdout);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment