How are theme setting fields created?

Does anyone know how one would access variables in the theme settings in Javsscript?

<script type="text/discourse-plugin" version="0.8.13">
    console.log(themeSettings.myvalue); 
</script>

I keep getting “themesettings is not defined” in the dev tools