Why doesn't command X work in combination with the Modern UI?
From NSIS Wiki
The Modern UI has different interface settings, language files etc. You won't get the result you were expecting when using commands like Icon, CheckBitmap, InstallColors etc. Please see the Modern UI Readme for details about Modern UI settings.