Have Mojave's Dark Mode switch PyCharm theme to Darcula
I have come up with a (hacky) way to change themes in JetBrains editors using bash and AppleScript. An example for PyCharm would be something like:

#!/bin/bash

# Switch macOS dark mode on and off
osascript -e '
    tell application "System Events"
        tell appearance preferences
            set dark mode to not dark mode
        end tell
    end tell
'

# Change PyCharm theme

# Assumes default key mappings
# Switch to dark theme if macOS dark mode is on
# 2&gt;/dev/null to suppress error if macOS dark mode is off
if defaults read -g AppleInterfaceStyle 2&gt;/dev/null | grep -q "Dark"; then
    osascript -e '
        if application "PyCharm" is running then
            -- switch focus to PyCharm
            tell application "PyCharm" to activate
            tell application "System Events"
                -- open Quick Switch Theme menu
                keystroke "`" using {control down}
                -- Select Look and Feel
                keystroke "5"
                delay 0.4
                -- Select Darcula
                keystroke "2"
            end tell
        end if
        '
# Switch to light theme if macOS dark mode is off
else
    osascript -e '
        if application "PyCharm" is running then
          tell application "PyCharm" to activate
            tell application "System Events"
                keystroke "`" using {control down}
                keystroke "5"
                delay 0.4
                keystroke "1"
            end tell
        end if
        '
fi


I actually use it as a part of a larger script but the code above should work fine for PyCharm only (or any other JetBrains IDE, just replace application name). If you experience issues, I would suggest increasing/introducing delays between keystrokes like the delay 0.4 in the code above.