How can I get the name of the current color scheme in terminal

This following AppleScript code will return the name of every theme currently being used in every Terminal window1.

tell windows of application "Terminal" to set themeNames to name of current settings

To run it from Terminal, simply run the following command:

osascript -e 'tell windows of application "Terminal" to return name of current settings'

It will return a comma-delimited list of the profile name for each open window in Terminal.


1 Since macOS High Sierra, tabs of a window in Terminal are treated as a window programmatically in AppleScript and therefore each physical window having multiple tabs can be using different themes. There will also be no grouping in the results, so e.g. one window having e.g. two tabs programmatically the two tabs are separate windows, not tabs like in macOS Sierra and earlier.